home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Information / Specifications / Audio File Formats / Audio File Formats FAQ
Text File  |  1996-06-23  |  115KB  |  2,741 lines

  1. Archive-name: audio-fmts
  2. Submitted-by: Guido van Rossum <guido@cwi.nl>
  3. Version: 3.10
  4. Last-modified: 2-Jan-1995
  5.  
  6. FAQ: Audio File Formats
  7. =======================
  8.  
  9. Table of contents
  10. -----------------
  11.  
  12. Introduction
  13. Device characteristics
  14. Popular sampling rates
  15. Compression schemes
  16. Current hardware
  17. File formats
  18. File conversions
  19. Playing audio files on UNIX
  20. Playing audio files on micros
  21. The Sound Site Newsletter
  22. Posting sounds
  23.  
  24. Appendices (in part 2):
  25.  
  26. FTP access for non-internet sites
  27. AIFF Format (Audio IFF)
  28. The NeXT/Sun audio file format
  29. IFF/8SVX Format
  30. Playing sound on a PC
  31. The EA-IFF-85 documentation
  32. US Federal Standard 1016 availability
  33. Creative Voice (VOC) file format
  34. RIFF WAVE (.WAV) file format
  35. U-LAW and A-LAW definitions
  36. AVR File Format
  37. The Amiga MOD Format
  38.  
  39.  
  40. Introduction
  41. ------------
  42.  
  43. This is version 3 of this FAQ, which I started in November 1991 under
  44. the name "The audio formats guide".  I bumped the major version number
  45. again at the occasion of the split in two parts: part one is the main
  46. text and part two consists of the collection of appendices.
  47.  
  48. I am posting this about once a fortnight, either unchanged (just to
  49. inform new readers), or updated (if I learn more or when new hardware
  50. or software becomes popular).  I post to alt.binaries.sounds.{misc,d}
  51. and to comp.dsp, for maximal coverage of people interested in audio,
  52. and to {news,comp}.answers, for easy reference.
  53.  
  54. The entire FAQ is also available by anonymous ftp from ftp.cwi.nl,
  55. directory pub/audio, files AudioFormats.{part1,part2}.
  56.  
  57. BTW: All FAQs, including this one, are available for anonymous ftp on
  58. the archive site rtfm.mit.edu in directory /pub/usenet/news.answers/.
  59. The name under which a FAQ is archived appears in the "Archive-Name:"
  60. line at the top of the article.  This FAQ is archived as
  61. audio-fmts/part[12].
  62.  
  63. A companion posting with subject "Changes to: ..." is occasionally
  64. posted listing the diffs between a new version and the last.  This is
  65. not reposted, and it is suppressed when the diffs are bigger than the
  66. new version.
  67.  
  68. Send updates, comments and questions to <guido@cwi.nl>.  I'd like to
  69. thank everyone who sent updates in the past.
  70.  
  71. --Guido van Rossum, CWI, Amsterdam <guido@cwi.nl>
  72.  
  73.  
  74. Device characteristics
  75. ----------------------
  76.  
  77. In this text, I will only use the term "sample" to refer to a single
  78. output value from an A/D converter, i.e., a small integer number
  79. (usually 8 or 16 bits).
  80.  
  81. Audio data is characterized by the following parameters, which
  82. correspond to settings of the A/D converter when the data was
  83. recorded.  Naturally, the same settings must be used to play the data.
  84.  
  85. - sampling rate (in samples per second), e.g. 8000 or 44100
  86.  
  87. - number of bits per sample, e.g. 8 or 16
  88.  
  89. - number of channels (1 for mono, 2 for stereo, etc.)
  90.  
  91. Approximate sampling rates are often quoted in Hz or kHz ([kilo-]
  92. Hertz), however, the politically correct term is samples per second
  93. (samples/sec).  Sampling rates are always measured per channel, so for
  94. stereo data recorded at 8000 samples/sec, there are actually 16000
  95. samples in a second.  I will sometimes write 8 k as a shorthand for
  96. 8000 samples/sec.
  97.  
  98. Multi-channel samples are generally interleaved on a frame-by-frame
  99. basis: if there are N channels, the data is a sequence of frames,
  100. where each frame contains N samples, one from each channel.  (Thus,
  101. the sampling rate is really the number of *frames* per second.)  For
  102. stereo, the left channel usually comes first.
  103.  
  104. The specification of the number of bits for U-LAW (pronounced mu-law
  105. -- the u really stands for the Greek letter mu) samples is somewhat
  106. problematic.  These samples are logarithmically encoded in 8 bits,
  107. like a tiny floating point number; however, their dynamic range is
  108. that of 12 bit linear data.  Source for converting to/from U-LAW
  109. (written by Jef Poskanzer) is distributed as part of the SOX package
  110. mentioned below; it can easily be ripped apart to serve in other
  111. applications.  The official definition is the CCITT standard G.711.
  112.  
  113. There exists another encoding similar to U-LAW, called A-LAW, which
  114. is used as a European telephony standard.  There is less support for
  115. it in UNIX workstations.
  116.  
  117. (See the Appendix for some formulae describing U-LAW and A-LAW.)
  118.  
  119.  
  120. Popular sampling rates
  121. ----------------------
  122.  
  123. Some sampling rates are more popular than others, for various reasons.
  124. Some recording hardware is restricted to (approximations of) some of
  125. these rates, some playback hardware has direct support for some.  The
  126. popularity of divisors of common rates can be explained by the
  127. simplicity of clock frequency dividing circuits :-).
  128.  
  129. Samples/sec     Description
  130.  
  131. 5500            One fourth of the Mac sampling rate (rarely seen).
  132.  
  133. 7333            One third of the Mac sampling rate (rarely seen).
  134.  
  135. 8000            Exactly 8000 samples/sec is a telephony standard that
  136.                 goes together with U-LAW (and also A-LAW) encoding.
  137.                 Some systems use an slightly different rate; in
  138.                 particular, the NeXT workstation uses 8012.8210513,
  139.                 apparently the rate used by Telco CODECs.
  140.  
  141. 11 k            Either 11025, a quarter of the CD sampling rate,
  142.                 or half the Mac sampling rate (perhaps the most
  143.                 popular rate on the Mac).
  144.  
  145. 16000           Used by, e.g. the G.722 compression standard.
  146.  
  147. 18.9 k          CD-ROM/XA standard.
  148.  
  149. 22 k            Either 22050, half the CD sampling rate, or the Mac
  150.                 rate; the latter is precisely 22254.545454545454 but
  151.                 usually misquoted as 22000.  (Historical note:
  152.                 22254.5454... was the horizontal scan rate of the
  153.                 original 128k Mac.)
  154.  
  155. 32000           Used in digital radio, NICAM (Nearly Instantaneous
  156.                 Compandable Audio Matrix [IBA/BREMA/BBC]) and other
  157.                 TV work, at least in the UK; also long play DAT and
  158.                 Japanese HDTV.
  159.  
  160. 37.8 k          CD-ROM/XA standard for higher quality.
  161.  
  162. 44056           This weird rate is used by professional audio
  163.                 equipment to fit an integral number of samples in a
  164.                 video frame.
  165.  
  166. 44100           The CD sampling rate.  (DAT players recording
  167.                 digitally from CD also use this rate.)
  168.  
  169. 48000           The DAT (Digital Audio Tape) sampling rate for
  170.                 domestic use.
  171.  
  172. Files samples on SoundBlaster hardware have sampling rates that are
  173. divisors of 1000000.
  174.  
  175. While professinal musicians disagree, most people don't have a problem
  176. if recorded sound is played at a slightly different rate, say, 1-2%.
  177. On the other hand, if recorded data is being fed into a playback
  178. device in real time (say, over a network), even the smallest
  179. difference in sampling rate can frustrate the buffering scheme used...
  180.  
  181. There may be an emerging tendency to standardize on only a few
  182. sampling rates and encoding styles, even if the file formats may
  183. differ.  The suggested rates and styles are:
  184.  
  185.     rate (samp/sec) style mono/stereo
  186.  
  187.     8000 8-bit U-LAW mono
  188.     22050 8-bit linear unsigned mono and stereo
  189.     44100 16-bit linear signed mono and stereo
  190.  
  191.  
  192. Compression schemes
  193. -------------------
  194.  
  195. Strange though it seems, audio data is remarkably hard to compress
  196. effectively.  For 8-bit data, a Huffman encoding of the deltas between
  197. successive samples is relatively successful.  For 16-bit data,
  198. companies like Sony and Philips have spent millions to develop
  199. proprietary schemes.  Information about PASC (Philips' scheme) can be
  200. found in Advanced Digital Audio by Ken C. Pohlmann.
  201.  
  202. Public standards for voice compression are slowly gaining popularity,
  203. e.g. CCITT G.721 (ADPCM at 32 kbits/sec) and G.723 (ADPCM at 24 and 40
  204. kbits/sec).  (ADPCM == Adaptive Delta Pulse Code Modulation.)  Sun
  205. Microsystems has placed the source code of a portable implementation of
  206. these algorithms (as well as G.711, which defines A-LAW and U-LAW) in
  207. the public domain (needless to say, their proprietary implementation
  208. distributed in binary form with Solaris is better :-).  One place to
  209. ftp this source code from is ftp.cwi.nl:/pub/audio/ccitt-adpcm.tar.Z.
  210. Source for another 32 kbits/sec ADPCM implementation, assumed to be
  211. compatible with Intel's DVI audio format, can be ftp'ed from
  212. ftp.cwi.nl:/pub/audio/adpcm.shar.  (** NOTE: if you are using v1.0,
  213. you should get v1.1, released 17-Dec-1992, which fixes a serious bug
  214. -- the quality of v1.1 is claimed to be better than U-LAW **)
  215.  
  216. GSM 06.10 is a speech encoding in use in Europe that compresses 160
  217. 13-bit samples into 260 bits (or 33 bytes), i.e. 1650 bytes/sec (at
  218. 8000 samples/sec).  A free implementation can be ftp'ed from
  219. tub.cs.tu-berlin.de, file /pub/tubmik/gsm-1.0.tar.Z.
  220.  
  221. There are also two US federal standards, 1016 (Code excited linear
  222. prediction (CELP), 4800 bits/s) and 1015 (LPC-10E, 2400 bits/s).  See
  223. also the appendix for 1016.
  224.  
  225. Tony Robinson <ajr@eng.cam.ac.uk> has written a good FAST loss-less
  226. compression for lots of different audio formats (particularly good for
  227. WAV and MOD files).  The software is available by anonymous ftp from
  228. svr-ftp.eng.cam.ac.uk, directory misc, file shorten-1.08.tar.Z.
  229.  
  230. (Note that U-LAW and silence detection can also be considered
  231. compression schemes.)
  232.  
  233. Here's a note about audio codings by Van Jacobson <van@ee.lbl.gov>:
  234. Several people used the words "LPC" and "CELP" interchangably.  They
  235. are very different.  An LPC (Linear Predictive Coding) coder fits
  236. speech to a simple, analytic model of the vocal tract, then throws
  237. away the speech & ships the parameters of the best-fit model.  An LPC
  238. decoder uses those parameters to generate synthetic speech that is
  239. usually more-or-less similar to the original.  The result is
  240. intelligible but sounds like a machine is talking.  A CELP (Code
  241. Excited Linear Predictor) coder does the same LPC modeling but then
  242. computes the errors between the original speech & the synthetic model
  243. and transmits both model parameters and a very compressed
  244. representation of the errors (the compressed representation is an
  245. index into a 'code book' shared between coders & decoders -- this is
  246. why it's called "Code Excited").  A CELP coder does much more work
  247. than an LPC coder (usually about an order of magnitude more) but the
  248. result is much higher quality speech: The FIPS-1016 CELP we're working
  249. on is essentially the same quality as the 32Kb/s ADPCM coder but uses
  250. only 4.8Kb/s (the same as the LPC coder).
  251.  
  252. The comp.compression FAQ has some text on the 6:1 audio compression
  253. scheme used by MPEG (a video compression standard-to-be).  It's
  254. interesting to note that video compression reaches much higher ratios
  255. (like 26:1).  This FAQ is ftp'able from rtfm.mit.edu in directory
  256. /pub/usenet/news.answers/compression-faq, files part1 and part2.
  257.  
  258. Comp.compression also carries a regular posting "How to uncompress
  259. anything" by David Lemson <lemson@uiuc.edu>, which (tersely) hints on
  260. which program you need to uncompress a file whose name ends in .<foo>
  261. for almost any conceivable <foo>.  Ftp'able from ftp.cso.uiuc.edu
  262. in the directory /doc/pcnet as the file compression.
  263.  
  264. Documentation on a digital cellular telephone system by Qualcomm Inc.
  265. can be ftp'ed from ftp.qualcomm.com:/pub/cdma; the vocoder is in
  266. appendix A.
  267.  
  268. Apple has an Audio Compression/Expansion scheme called ACE (on the GS)
  269. / MACE (on the Macintosh).  It's a lossy scheme that attempts to
  270. predict where the wave will go on the next sample. There's very little
  271. quality change on 8:4 compression, somewhat more for 8:3.  It does
  272. guarantee exactly 50% or 62.5% compression, though.  I believe MACE
  273. uses larger ratios/more loss, but I'm unsure of the specific numbers.
  274. (Marc Sira)
  275.  
  276.  
  277. Current hardware
  278. ----------------
  279.  
  280. I am aware of the following computer systems that can play back and
  281. (sometimes) record audio data, with their characteristics.  Note that
  282. for most systems you can also buy "professional" sampling hardware,
  283. which supports much better quality, e.g. >= 44.1 k 16 bits stereo.
  284. The characteristics listed here are a rough estimate of the
  285. capabilities of the basic hardware only (and even here I am on thin
  286. ice, with systems becoming ever more powerful).
  287.  
  288. machine             bits            max sampling rate    #output channels
  289.  
  290. Mac (all types)     8               22k                  1
  291. Mac (newer ones)    16              64k                  4(128)
  292. Apple IIgs          8               32k / >70k           16(st)
  293. PC/soundblaster pro 8               ?/(22k st, 44.1k mo) 1(st)
  294. PC/soundblaster 16  16              44.1k                1(st)
  295. PC/pas              8               44.1k st, 88.2k mo   1(st)
  296. PC/pas-16           16              44.1k st, 88.2k mo   1(st)
  297. PC/turtle beach multisound 16       44.1k                1(st)
  298. PC/cards with aria chipset 16       44.1k                1(st)
  299. PC/roland rap-10    16              44.1k                1(st)
  300. PC/gravis ultrasound 8/16           44.1k                14-32(st)
  301. Atari ST            8               22k                  1
  302. Atari STE,TT        8               50k                  2
  303. Atari Falcon 030    16              50k                  8(st)
  304. Amiga               8               varies above 29k     4(st)
  305. Sun Sparc           U-LAW           8k                   1
  306. Sun Sparcst. 10     U-LAW,8,16      48k                  1(st)
  307. NeXT                U-LAW,8,16      44.1k                1(st)
  308. SGI Indigo          8,16            48k                  4(st)
  309. SGI Indigo2,Indy    8,16            48k                  16(st,4-channel)
  310. Acorn Archimedes    ~U-LAW          ~180k                8(st)
  311. Sony NWS-3xxx       U,A,8,16        8-37.8k              1(st)
  312. Sony NWS-5xxx       U,A,8,16        8-48k                1(st)
  313. VAXstation 4000     U-LAW           8k                   1
  314. DEC 3000            U-LAW           8k                   1
  315. DEC 5000/20-25      U-LAW           8k                   1
  316. Tandy 1000/*L*      8               >=44k                1
  317. Tandy 2500          8               >=44k                1
  318. HP9000/705,710,425e U,A-LAW,16      8k                   1
  319. HP9000/715,725,735  U,A-LAW,16      48k                  1(st)
  320. HP9000/755 option:  U,A-LAW,16      48k                  1(st)
  321. NCD MCX terminal    U,A,8,16        52k                  1(st)
  322.  
  323. 4(st) means "four voices, stereo"; sampling rates xx/yy are
  324. different recording/playback rates; *L* is any type with 'L' in it.
  325.  
  326. All these machines can play back sound without additional hardware,
  327. although the needed software is not always standard; also, some
  328. machines need external hardware to record sound (or to record at
  329. higher quality, like the NeXT, whose built-in sampling hardware only
  330. does 8000 samples/sec in U-LAW).  Please don't send me details on
  331. optional or 3rd party hardware, there is too much and it is really
  332. beyond the scope of this FAQ.  In particular, there is a separate
  333. newsgroup devoted to PC sound cards: comp.sys.ibm.pc.soundcard, which
  334. includes FAQ of its own (also posted to comp.answers and news.answers).
  335.  
  336. The new VAXstation 4000 (VLC and model 60) series lets you PLAY audio
  337. (.au) files, and the package DECsound will let you do the recording.
  338. In fact, DECsound is given away free with Motif 1.1 and supports the
  339. VAXstation, Sun SPARCstation, DECvoice, and DECaudio devices.  Sun
  340. sound files work without change.  The Alpha systems also have DECsound
  341. bundled with Motif.  Also, the DEC2000/300 (aka DECpc AXP 150) can use
  342. a Microsoft Sound Card, with AudioFile (see below) for sound.
  343.  
  344. Notes for the DECstation 5000/20-25: You need either XMedia tools from
  345. DEC ($$$$), or the AudioFile package (which works nicely) from
  346. crl.dec.com (see below). The audio device is "/dev/bba", you cannot
  347. send ".au" files directly to the device, the Xmedia/AF software
  348. provide an "audioserver" which must be run to play/record sounds.
  349.  
  350. The SGI Personal IRIS 4D/30 and 4D/35 have the same capabilities as
  351. the Indigo. The audio board was optional on the 4D/30.
  352. The Indigo2 and Indy features are a superset of the Indigo features.
  353.  
  354. The new Apple Macs have more powerful audio hardware; the latest
  355. models have built-in microphones.
  356.  
  357. Software exists for the PC that can play sound on its 1-bit speaker
  358. using pulse width modulation (see appendix); the Soundblaster board
  359. records at rates up to 13 k and plays back up to 22 k (weird
  360. combination, but that's the way it is).
  361.  
  362. Here's some info about the newest Atari machine, the Falcon030.  This
  363. machine has stereo 16 bit CODECs and a 32 MHz Motorola 56001 that can
  364. handle 8 channels of 16 bit audio, up to 50 khz/channel with
  365. simultaneous playback and record.  The Falcon DMA sound engine is also
  366. compatible with the 8 bit stereo DMA used on the STe and TT. All of
  367. these systems use signed data.
  368.  
  369. On the NeXT, the Motorola 56001 DSP chip is programmable and you can
  370. (in principle) do what you want.  The SGI Indigo uses the same DSP chip but
  371. it can't be programmed by users -- SGI prefers to offer it as a shared
  372. system resource to multiple applications, thus enabling developers to
  373. program audio with their Audio Library and avoid code modifications
  374. for execution on future machines with different audio hardware, i.e. a
  375. different DSP. For example, the Indigo2 and Indy do not have a DSP chip.
  376.  
  377. The Amiga also has a 6-bit volume, which can be used to produce
  378. something like a 14-bit output for each voice.  The hardware can also
  379. use one of each voice-pair to modulate the other in FM (period) or AM
  380. (volume, 6-bits).
  381.  
  382. The Acorn Archimedes uses a variation on U-LAW with the bit order
  383. reversed and the sign bit in bit 0.  Being a 'minority' architecture,
  384. Arc owners are quite adept at converting sound/image formats from
  385. other machines, and it is unlikely that you'll ever encounter sound in
  386. one of the Arc's own formats (there are several).
  387.  
  388. Tandy notes (Jeffrey L. Hayes <tvdog@delphi.com>): The maximum
  389. sampling rate for output is at least 44k.  (I don't know the maximum
  390. rates; I have recorded at 22k and played at 44k.  Higher rates are
  391. probably possible.)  There is one output channel, not three.  The
  392. belief that there are 3 channels probably stems from the fact that
  393. Music.pdm, bundled with these machines, can create 3- channel music
  394. modules (analogous to Amiga .mod's).  Music.pdm probably does that
  395. because it is designed to work with the Tandy's 3-voice tone generator
  396. circuitry (compatible with the Texas Instruments SN76496 in the IBM
  397. PC-Jr) if there is insufficient RAM to load sound samples.  The Tandy
  398. chip is able to record at lower rates than it is able to play back, as
  399. is the Soundblaster (i.e., the divider used to program the chip to
  400. record is lower than that used to program the chip to play back).  The
  401. Tandy DAC can go faster than the original Soundblaster, however.
  402.  
  403. The NCD MCX terminal has audio integrated with its X server.  The
  404. NCDAudio server is an extension of the X server, working together with
  405. it, with stress on the networking capability of sound transmission.
  406. The NCDAudio API provides format handling (ULAW8, Linear Unsig 8,
  407. Linear Sig 8, Linear Sig 16 MSB, Linear Unsig 16 MSB), flowing (to the
  408. server, from the server, to the i/o, from the i/o), wave form
  409. generators (Square, Sine, Saw, Constant) and the capability of area
  410. broadcast using UDP.  Provision for manipulating data files
  411. (SND, WAV, VOC & AU) is also provided.
  412.  
  413. CD-I machines form a special category.  The following formats are used:
  414.  
  415.      - PCM 44.1 kHz standard CD format
  416.      - ADPCM - Addaptive Delta PCM
  417.        - Level A 37.8 kHz 8-bit
  418.        - Level B 37.8 kHz 4-bit
  419.        - Level C 18.9 kHz 4-bit
  420.  
  421.  
  422. File formats
  423. ------------
  424.  
  425. Historically, almost every type of machine used its own file format
  426. for audio data, but some file formats are more generally applicable,
  427. and in general it is possible to define conversions between almost any
  428. pair of file formats -- sometimes losing information, however.
  429.  
  430. File formats are a separate issue from device characteristics.  There
  431. are two types of file formats: self-describing formats, where the
  432. device parameters and encoding are made explicit in some form of
  433. header, and "raw" formats, where the device parameters and encoding
  434. are fixed.
  435.  
  436. Self-describing file formats generally define a family of data
  437. encodings, where a header fields indicates the particular encoding
  438. variant used.  Headerless formats define a single encoding and usually
  439. allows no variation in device parameters (except sometimes sampling
  440. rate, which can be a pain to figure out other than by listening to the
  441. sample).
  442.  
  443. The header of self-describing formats contains the parameters of the
  444. sampling device and sometimes other information (e.g. a
  445. human-readable description of the sound, or a copyright notice).  Most
  446. headers begin with a simple "magic word".  (Some formats do not simply
  447. define a header format, but may contain chunks of data intermingled
  448. with chunks of encoding info.)  The data encoding defines how the
  449. actual samples are stored in the file, e.g. signed or unsigned, as
  450. bytes or short integers, in little-endian or big-endian byte order,
  451. etc.  Strictly spoken, channel interleaving is also part of the
  452. encoding, although so far I have seen little variation in this area.
  453.  
  454. Some file formats apply some kind of compression to the data, e.g.
  455. Huffman encoding, or simple silence deletion.
  456.  
  457. Here's an overview of popular file formats.
  458.  
  459.         Self-describing file formats
  460.         ----------------------------
  461.  
  462. extension, name   origin          variable parameters (fixed; comments)
  463.  
  464. .au or .snd       NeXT, Sun       rate, #channels, encoding, info string
  465. .aif(f), AIFF     Apple, SGI      rate, #channels, sample width, lots of info
  466. .aif(f), AIFC     Apple, SGI      same (extension of AIFF with compression)
  467. .iff, IFF/8SVX    Amiga           rate, #channels, instrument info (8 bits)
  468. .voc              Soundblaster    rate (8 bits/1 ch; can use silence deletion)
  469. .wav, WAVE        Microsoft       rate, #channels, sample width, lots of info
  470. .sf               IRCAM           rate, #channels, encoding, info
  471. none, HCOM        Mac             rate (8 bits/1 ch; uses Huffman compression)
  472. none, MIME        Internet        (see below)
  473. none, NIST SPHERE DARPA speech community (see below)
  474. .mod or .nst      Amiga           (see below)
  475.  
  476. Note that the filename extension ".snd" is ambiguous: it can be either
  477. the self-describing NeXT format or the headerless Mac/PC format, or
  478. even a headerless Amiga format.
  479.  
  480. I know nothing for sure about the origin of HCOM files, only that
  481. there are a lot of them floating around on our system and probably at
  482. FTP sites over the world.  The filenames usually don't have a ".hcom"
  483. extension, but this is what SOX (see below) uses.  The file format
  484. recognized by SOX includes a MacBinary header, where the file
  485. type field is "FSSD".  The data fork begins with the magic word "HCOM"
  486. and contains Huffman compressed data; after decompression it it is 8
  487. bits unsigned data.
  488.  
  489. IFF/8SVX allows for amplitude contours for sounds (attack/decay/etc).
  490. Compression is optional (and extensible); volume is variable; author,
  491. notes and copyright properties; etc.
  492.  
  493. AIFF, AIFC and WAVE are similar in spirit but allow more freedom in
  494. encoding style (other than 8 bit/sample), amongst others.
  495.  
  496. There are other sound formats in use on Amiga by digitizers and music
  497. programs, such as IFF/SMUS.
  498.  
  499. Appendices describes the NeXT and VOC formats; pointers to more info
  500. about AIFF, AIFC, 8SVX and WAVE (which are too complex to describe
  501. here) are also in appendices.
  502.  
  503. DEC systems (e.g. DECstation 5000) use a variant of the NeXT format
  504. that uses little-endian encoding and has a different magic number
  505. (0x0064732E in little-endian encoding).
  506.  
  507. Standard file formats used in the CD-I world are IFF but on the disc
  508. they're in realtime files.
  509.  
  510. An interesting "interchange format" for audio data is described in the
  511. proposed Internet Standard "MIME", which describes a family of
  512. transport encodings and structuring devices for electronic mail.  This
  513. is an extensible format, and initially standardizes a type of audio
  514. data dubbed "audio/basic", which is 8-bit U-LAW data sampled at 8000
  515. samples/sec.
  516.  
  517. The "IRCAM" sound file system has now been superseded by the so-called
  518. "BICSF" (for Berkeley/IRCAM/CARL Sound File system) software release.
  519. More recently, there has been an effort at Princeton (Prof. Paul
  520. Lansky) and Stanford (Stephen Travis Pope) to standardize several
  521. extensions to BICSF.  A description of BICSF and the
  522. Princeton/Stanford extensions is available by anonymous ftp from
  523. ftp.cwi.nl, in directory /pub/audio/BICSF-info.  This file contains
  524. further ftp pointers to software.
  525.  
  526. A sound file format popular in the DARPA speech community is the NIST
  527. SPHERE standard.  The most recent version of the SPHERE package is
  528. available via anonymous ftp from jaguar.ncsl.nist.gov in compressed
  529. tar form as "sphere-v.tar.Z" (where "v" is the version code).  The
  530. NIST SPHERE header is an object-oriented, 1024-byte blocked, ASCII
  531. structure which is prepended to the waveform data.  The header is
  532. composed of a fixed-format portion followed by an object-oriented
  533. variable portion.  I have placed a short description of NIST SPHERE on
  534. ftp.cwi.nl:/pub/audio/NIST-SPHERE.
  535.  
  536. Finally, a somewhat different but popular format are "MOD" files,
  537. usually with extension ".mod" or ".nst" (they can also have a prefix
  538. of "mod.").  This originated at the Amiga but players now exist for
  539. many platforms.  MOD files are music files containing 2 parts: (1) a
  540. bank of digitized samples; (2) sequencing information describing how
  541. and when to play the samples.  See the appendix "The Amiga MOD Format"
  542. for a description of this file format (and pointers to ftp'able
  543. players and example MOD files).
  544.  
  545.         Headerless file formats
  546.         -----------------------
  547.  
  548. extension       origin          parameters
  549. or name
  550.  
  551. .snd, .fssd     Mac, PC         variable rate, 1 channel, 8 bits unsigned
  552. .ul             US telephony    8 k, 1 channel, 8 bit "U-LAW" encoding
  553. .snd?           Amiga           variable rate, 1 channel, 8 bits signed
  554.  
  555. It is usually easy to distinguish 8-bit signed formats from unsigned
  556. by looking at the beginning of the data with 'od -b <file | head';
  557. since most sounds start with a little bit of silence containing small
  558. amounts of background noise, the signed formats will have an abundance
  559. of bytes with values 0376, 0377, 0, 1, 2, while the unsigned formats
  560. will have 0176, 0177, 0200, 0201, 0202 instead.  (Using "od -c" will
  561. also show any headers that are tacked in front of the file.)
  562.  
  563. The Apple IIgs records raw data in the same format as the Mac, but
  564. uses a 0 byte as a terminator; samples with value 0 are replaced by 1.
  565.  
  566.         Sound formats and the Apple Macintosh
  567.         -------------------------------------
  568.  
  569. (Thanks to Bill Houle, <Bill.Houle@SanDiegoCA.NCR.COM>)
  570.  
  571.                              SOX/DOS   MAC
  572. Sound Format           file ext  type  Mac program to convert to 'snd'
  573. ---------------------- --------  ----  -------------------------------
  574. Mac snd                .snd      sfil  [n/a]
  575. Amiga IFF/8SVX         .iff            AmigaSndConverter, BST
  576. Amiga SoundTracker     .mod      STrk  ModVoicer
  577. Audio IFF              .aiff     AIFF  SoundExtractor, Sample Editor,
  578.                                        UUTool, BST, M5Mac
  579. DSP Designer                     DSPs  SoundHack
  580. IRCAM                  .sf       IRCM  SoundHack
  581. MacMix                           MSND  SoundHack
  582. RIFF WAVE              .wav            SoundExtractor, BST, Balthazar
  583. SoundBlaster           .voc            SoundExtractor, BST
  584. SoundDesigner/AudioMedia         Sd2f  SoundHack
  585. Sound[Edit|Cap|Wave]   .hcom     FSSD  SoundExtractor, SoundEdit,
  586.                                        Wavicle, BST
  587. Sun uLaw/Next .snd     .au/.snd  NxTS  SoundExtractor, SoundHack,
  588.                                        au<->snd, UUTool, BST
  589.  
  590.  
  591. File conversions
  592. ----------------
  593.  
  594.         SOX (UNIX, PC, Amiga)
  595.         ---------------------
  596.  
  597. The most versatile tool for converting between various audio formats
  598. is SOX ("Sound Exchange").  It can read and write various types of
  599. audio files, and optionally applies some special effects (e.g. echo,
  600. channel averaging, or rate conversion).
  601.  
  602. SOX recognizes all filename extensions listed above except ".snd",
  603. which would be ambiguous anyway, and ".wav" (but there's a patch, see
  604. below).  Use type ".au" for NeXT ".snd" files.  Mac and PC ".snd"
  605. files are completely described by these parameters:
  606.  
  607.         -t raw -b -u -r 11000
  608.  
  609. (or -r 22000 or -r 7333 or -r 5500; 11000 seems to be the most common
  610. rate).
  611.  
  612. The source for SOX, version 6, platchlevel 8, was posted to
  613. alt.sources, and should be widely archived.  (Patch 9 was posted later
  614. and incporporates some important .wav fixes.)  To save you the trouble
  615. of hunting it down, it can be gotten by anonymous ftp from
  616. wuarchive.wustl.edu, in the directory usenet/alt.sources/articles,
  617. files 7288.Z through 7295.Z.  (These files are compressed news
  618. articles containing shar files, if you hadn't guessed.)  I am sure
  619. many sites have similar archives, I'm just listing one that I know of
  620. and which carries a lot of this kind of stuff.  (Also see the appendix
  621. if you don't have Internet access.)
  622.  
  623. A compressed tar file containing the same version of SOX is available
  624. by anonymous ftp from ftp.cwi.nl, in directory
  625. /pub/audio/sox<version>.tar.Z.  You may be able to locate a nearer
  626. version using archie!
  627.  
  628. Ports of SOX:
  629.  
  630. - The source as posted should compile on any UNIX and PC system.
  631.  
  632. - A PC version is available by ftp from ftp.cwi.nl (see above) as
  633.   pub/audio/sox5dos.zip; also available from the garbo mail server.
  634.  
  635. - The latest Amiga SOX is available via anonymous ftp to
  636.   wuarchive.wustl.edu, files systems/amiga/audio/utils/amisox*.  (See
  637.   below for a non-SOX solution.)
  638.   The final release of r6 will compile as distributed on the Amiga with
  639.   SAS/C version 6.  Binaries (since many Amiga users do not own
  640.   compilers) will continue to be available for FTP.
  641.  
  642. SOX usage hints:
  643.  
  644. - Often, the filename extension of sound files posted on the net is
  645.   wrong.  Don't give up, try a few other possibilities using the
  646.   "-t <type>" option.  Remember that the most common file type is
  647.   unsigned bytes, which can be indicated with "-t ub".  You'll have to
  648.   guess the proper sampling rate, but often it's 11k or 22k.
  649.  
  650. - In particular, with SOX version 4 (or earlier), you have to
  651.   specify "-t 8svx" for files with an .iff extension.
  652.  
  653. - When converting linear samples to U-LAW using the .au type for the
  654.   output file, you must specify "-U" for the output file, otherwise
  655.   you will end up with a file containing a NeXT/Sun header but linear
  656.   samples -- only the NeXT will play such files correctly.  Also, you
  657.   must explicitly specify an output sampling rate with "-r 8000".
  658.   (This may seem fixed for most cases in version 5, but it is still
  659.   occasionally necessary, so I'm keeping this warning in.)
  660.  
  661.         Sun Sparc
  662.         ---------
  663.  
  664. On Sun Sparcs, starting at SunOS 4.1, a program "raw2audio" is
  665. provided by Sun (in /usr/demo/SOUND -- see below) which takes a raw
  666. U-LAW file and turns it into a ".au" file by prefixing it with an
  667. appropriate header.
  668.  
  669.         NeXT
  670.         ----
  671.  
  672. On NeXTs, you can usually rename .au files to .snd and it'll work like
  673. a charm, but some .au files lack header info that the NeXT needs.
  674. This can be fixed by using sndconvert:
  675.  
  676.         sndconvert -c 1 -f 1 -s 8012.8210513 -o nextfile.snd sunfile.au
  677.  
  678.         SGI Indigo, Indigo2, Indy and Personal IRIS
  679.         -------------------------------------------
  680.  
  681. SGI supports "soundfiler" (in /usr/sbin), a program similar in
  682. spirit to SOX but with a GUI.  Soundfiler plays aiff, aifc, NeXT/Sun
  683. and .wav formats.  It can do conversions between any of these formats
  684. and to and from raw formats including mulaw.  It also does sample rate
  685. conversions.
  686.  
  687. Three shell commands are also provided that give the same functionality:
  688. "sfplay", "sfconvert", and "aifcresample" (all in /usr/sbin).
  689.  
  690.         Amiga
  691.         -----
  692.  
  693. Mike Cramer's SoundZAP can do no effects except rate change and it
  694. only does conversions to IFF, but it is generally much faster than
  695. SOX.  (Ftp'able from the same directory as amisox above.)
  696.  
  697. Newer versions of OmniPlay (see below) will also convert to IFF.
  698.  
  699.         Tandy
  700.         -----
  701.  
  702. The Tandy uses a proprietary format, which can use compression
  703. (see appendix).  Jeffrey L. Hayes <tvdog@delphi.com> writes:
  704.  
  705. There is in fact a Windows 3.1 sound driver for the Tandy 2500-series 
  706. available from Radio Shack.  My informant says:  "Say that you have a 
  707. 2500SX/33 and you lost your Windows Utilities/Drivers disk.  The cost is 
  708. $5.00."  (The driver will work on any 2500.)
  709.  
  710. Version 2.00 of Conv2snd by Kenneth Udut by Kenneth Udut is now on
  711. Simtel.  It converts any 8-bit mono unsigned PCM file to Tandy
  712. DeskMate .snd format.  The new version recognizes RIFF WAVE headers
  713. and comes with a utility to convert .snd to .wav, Snd2wav.
  714.  
  715. In addition to the .snd format used by Sound.pdm, Tandy used an .sng format 
  716. with Music.pdm for song files.  .sng files are analogous to Amiga .mod 
  717. files, but they contain only the sequencing information.  The samples are 
  718. expected to be in .snd files in the current directory for Music.pdm.  It 
  719. should be possible to convert .sng to .mod - when I get around to it!
  720.  
  721. I have a collection of programs and information on the Tandy DAC on Simtel:  
  722. oak.oakland.edu:/pub/msdos/sound/tspak.zip.  A program to convert Tandy 
  723. .snd to .mod samples is included.
  724.  
  725. There are two Tandy .snd formats.  The old format was used on the 1000's; 
  726. the new format on the 2500's.  The 2500's can read the old format.
  727.  
  728. Tandy now includes Soundblaster support in its machines.  New Tandy's do 
  729. not have the proprietary Tandy DAC.
  730.  
  731.  
  732.         Apple Macintosh
  733.         ---------------
  734.  
  735. Bill Houle sent the following list:
  736.  
  737. Popular commercial apps are indicated with a [*].  All other programs
  738. mentioned are shareware/freeware available from SUMEX and the various
  739. mirror sites, or check archie for the nearest FTP location.
  740.  
  741. MAC SOUND CONVERSION PROGRAMS
  742.  
  743. SoundHack [Tom Erbe, tom@mills.edu]
  744.   Can read/write Sound Designer II, Audio IFF, IRCAM, DSP Designer and NeXT 
  745.   .snd (or Sun .au); 8-bit uLaw, 8-bit linear, 32-bit floating point and 16-bit
  746.   linear data encoding.  Can read (but not write) raw data files.  Implements
  747.   soundfile convolution, a phase vocoder, a binaural filter and an amplitude 
  748.   analysis & gain change module.
  749.  
  750. SoundExtractor [Alberto Ricci, FRicci@polito.it]
  751.   Extracts 'snd' resources, AIFF, SoundEdit, VOC, and WAV data from
  752.   practically anything, converting to 'snd' files.
  753.  
  754. Balthazar [Craig Marciniak, AOL:TemplarDev]
  755.   Converts WAV files to 'snd'.
  756.   
  757. Brian's Sound Tool [Brian Scott, bscott@ironbark.ucnv.edu.au]
  758.   Converts 'snd' or SoundEdit to WAV.  Can also convert WAV, VOC, AIFF, Amiga
  759.   8SVX and uLaw to 'snd'.
  760.  
  761. AmigaSndConverter [Povl H. Pederson, eco861771@ecostat.aau.dk]
  762.   Converts Amiga IFF/8SVX to Mac 'snd'.
  763.  
  764. au<->Mac [Victor J. Heinz, vic:wbst128@xerox.com]
  765.   Converts Sun uLaw to Mac 'snd'.
  766.   
  767. ULAW [Rod Kennedy, rod@faceng.anu.edu.au]
  768.   Converts 'snd' to Sun uLaw.
  769.  
  770. UUTool [Bernie Wieser, wieser@acs.ucalgary.ca]
  771.   Primarily a uuencode/decode program, but in true Swiss Army Knife
  772.   fashion can also read/write Sun uLaw, AIFF, and 'snd' files.
  773.  
  774. ModVoicer [Kip Walker, Kip_Walker@mcimail.com]
  775.   Converts Amiga MOD voices into SoundEdit files or 'snd' resources.
  776.  
  777. Music 5 Mac [Simone Bettini, space@maya.dei.unipd.it]
  778.   Primarily a Music Synthesis system, but can also convert between 'snd', AIFF,
  779.   and IBM .DAT(?).
  780.  
  781. See also the section on players -- some players also do conversions.
  782.  
  783.  
  784. Playing audio files on UNIX
  785. ---------------------------
  786.  
  787. The commands needed to play an audio file depend on the file format
  788. and the available hardware and software.  Most systems can only
  789. directly play sound in their native format; use a conversion program
  790. (see above) to play other formats.
  791.  
  792.         Sun Sparcstation running SunOS 4.x
  793.         ----------------------------------
  794.  
  795. Raw U-LAW files can be played using "cat file >/dev/audio".
  796.  
  797. A whole package for dealing with ".au" files is provided by Sun on an
  798. experimental basis, in /usr/demo/SOUND.  You may have to compile the
  799. programs first.  (If you can't find this directory, either you are not
  800. running SunOS 4.1 yet, or your system administrator hasn't installed
  801. it -- go ask him for it, not me!)  The program "play" in this
  802. directory recognizes all files in Sun/NeXT format, but a SS 1 or 2 can
  803. play only those using U-LAW encoding at 8 k -- the SS 10 hardware
  804. plays other encodings, too.
  805.  
  806. If you ca't find "play", you can also cat a ".au" file to /dev/audio,
  807. if it uses U-LAW; the header will sound like a short burst of noise
  808. but the rest of the data will sound OK (really, the only difference in
  809. this case between raw U-LAW and ".au" files is the header; the U-LAW
  810. data is exactly the same).
  811.  
  812. Finally, OpenWindows 3.0 has a full-fledged audio tool.  You can drop
  813. audio file icons into it, edit them, etc.
  814.  
  815.         Sun Sparcstation running Solaris 2.0
  816.         ------------------------------------
  817.  
  818. Under SVR4 (and hence Solaris 2.0), writing to /dev/audio from the
  819. shell is a bad idea, because the device driver will flush its queue as
  820. soon as the file is closed.  Use "audioplay" instead.  The supported
  821. formats and sampling rates are the same as above.
  822.  
  823.         NeXT
  824.         ----
  825.  
  826. On NeXT machines, the standard "sndplay" program can play all NeXT
  827. format files (this include Sun ".au" files).  It supports at least
  828. U-LAW at 8 k and 16 bits samples at 22 or 44.1 k.  It attempts
  829. on-the-fly conversions for other formats.
  830.  
  831. Sound files are also played if you double-click on them in the file
  832. browser.
  833.  
  834.         SGI Indigo, Indigo2, Indy and Personal IRIS
  835.         -------------------------------------------
  836.  
  837. On SGI Indigo, Indigo2, Indy and the 4D/30 and /35 Personal IRIS workstations,
  838. "WorkSpace" plays audio files in .aiff, .aifc, .au, and .wav formats if
  839. you double click them and the sampling rate is one of 8000, 11025,
  840. 16000, 22050, 32000, 44100, or 48000.  On the Personal IRIS, you need
  841. to have the audio board installed (check the output from hinv) and you
  842. must run IRIX 3.3.2 or 4.0 or higher.  These files can also be played
  843. with "soundfiler" and "sfplay".  ".aiff" and ".aifc" files at the above
  844. sampling rates can also be played with playaifc.  (All in /usr/sbin)
  845.  
  846. There is no simple /dev/audio interface on these SGI machines.  (There
  847. was one on 4D/25 machines, reading and writing signed linear 8-bit
  848. samples at rates of 8, 16 and 32 k.)
  849.  
  850. A program "playulaw" was posted as part of the "radio 2.0" release
  851. that I posted to several source groups; it plays raw U-LAW files on
  852. the Indigo, Indigo2, Indy or Personal IRIS audio hardware.
  853.  
  854.         Sony NEWS
  855.         ---------
  856.  
  857. The whole current Sony NEWS line (laptop, desktop, server) have
  858. builtin sound capabilities.  You can buy an external board for the
  859. older NEWS machines.  In the default mode (8k/8-bit mulaw), Sun .au
  860. files are directly supported (you can 'cat' .au files to /dev/sb0 and
  861. have them play.)  The /usr/sony/bin/sbplay command on NEWS-OS 6.0
  862. also supports Sun .au files.
  863.  
  864.         Others
  865.         ------
  866.  
  867. Most other UNIX boxes don't have audio hardware and thus can't play
  868. audio data.  This is actually rapidly changing and most new hardware
  869. that hits the market has some form of audio support.  Unfortunately
  870. there is no single portable interface for audio that comes near the
  871. acceptance and functionality (let alone code size :-) of X11 for
  872. graphics.  There are at least two network-transparent packages, both
  873. in some way based on the X11 architecture, that attempt to fillo the
  874. gap:
  875.  
  876. DEC CRL's AudioFile supports Digital RISC systems running Ultrix,
  877. Digital Alpha AXP systems running OSF/1, Sun Sparcs, and SGI
  878. AL-capable systems (e.g., Indigo, Indy).  The source kit is located at
  879. ftp site crl.dec.com in /pub/DEC/AF.
  880.  
  881. NCD's NetAudio supports NCD's MCX line of X terminals as well as
  882. Sparcs running either SunOS 4.1.3 or Solaris 2.2, using the /dev/audio
  883. interface (they claim it should be easy to port).  The source it
  884. located at ftp.x.org in contrib/netaudio.  It is also ported to SGI
  885. (tested on IRIX 5.x), and there are unconfirmed rumors that it is
  886. being ported to SCI and Linux.
  887.  
  888.  
  889. Playing audio files on the Vaxstation 4000 (VMS)
  890. ------------------------------------------------
  891.  
  892. 1) Without DECsound
  893.  
  894. ".au" files can be played by COPYING them to device "SOA0:".  This
  895. device is set up by enabling the driver SODRIVER.  You can use the
  896. following command file:
  897.  
  898. $!---------------- cut here -------------------------------
  899. $! sound_setup.com    enable SOUND driver
  900. $ run sys$system:sysgen
  901. connect soa0 /adapter=0 /csr=%x0e00 /vector=%o304 /driver=sodriver
  902. exit
  903. $ exit
  904. $!----------------- cut here ------------------------------------
  905.  
  906. 2) With DECsound (bundled with motif)
  907.  
  908. Just start DECsound by selecting it from the session manager in the 
  909. applications menu. (Not there use "@vue$library:sound$vue_startup").
  910. Make sure settings; device type (vaxstation 4000) and play settings
  911. (headphone jack) are selected.  To play files from the DCL prompt 
  912. (handy if you want to play sounds on a remote workstation) set a 
  913. symbol up as follows; 
  914. PLAY == "$DECSOUND -VOLUME 50 -PLAY"
  915. usage;
  916. DCL> play sound.au
  917.  
  918. 3) Audio port
  919.  
  920. The external audio port comes with a telephone-jack-like port.   For
  921. starters, you can plug a telephone RECEIVER right into this port to
  922. hear your first sound files.   After that, you can use the adapter
  923. (that came with the VaxStation), and plug in a small set of stereo
  924. speakers or headphones (the kind you'd plug into a WALKMAN, for 
  925. example), for more volume.  The adapter also has a microphone plug so
  926. that you can record sounds if DECsound is installed.
  927.  
  928.  
  929. Playing audio files on micros
  930. -----------------------------
  931.  
  932. Most micros have at least a speaker built in, so theoretically all you
  933. need is the right software.  Unfortunately most systems don't come
  934. bundled with sound-playing software, so there are many public domain
  935. or shareware software packages, each with their own bugs and features.
  936. Most separate sound recording hardware also comes with playing
  937. software, most of which can play sound (in the file format used by
  938. that hardware) even on machines that don't have that hardware
  939. installed.
  940.  
  941.         PC or compatible
  942.         ----------------
  943.  
  944. Chris S. Craig announces the following software for PCs:
  945.  
  946. ScopeTrax       This is a complete PC sound player/editor package.  Sounds
  947.                 can be played back at ANY rate between 1kHz to 65kHz through
  948.                 the PC speaker or the Sound Blaster.  It supports several
  949.                 file formats including VOC, IFF/8SVX, raw signed and raw
  950.                 unsigned.  A separate executable is provided to convert
  951.                 .au and mu-law to raw format.  ScopeTrax requires EGA/VGA
  952.                 graphics for editing and displaying sounds on a REALTIME
  953.                 oscilloscope.  The package also includes:
  954.                       * An expanded memory player which can play sounds
  955.                         larger than 640K in size.
  956.                       * Basic (rough) sound compression/uncompression
  957.                         utilities.
  958.                       * Complete documentation.
  959.                 The package is FREEWARE!  It is available on SIMTEL in the
  960.                 PD1:[MSDOS.SOUND] directory.
  961.  
  962. One of the appendices below contains a list of more programs to play
  963. sound on the PC.
  964.  
  965.         Atari
  966.         -----
  967.  
  968. For sounds on Atari STs - programs are in the atari/sound/players
  969. directory on atari.archive.umich.edu.
  970.  
  971.         Tandy
  972.         -----
  973.  
  974. On a Tandy 1000 or 2500, sounds can be played and recorded with DeskMate 
  975. Sound (SOUND.PDM), or if they are not stored in compressed format, they can 
  976. also be played by a program called PLAYSND.  Playsnd also plays .voc, .wav, 
  977. .iff, .mod samples, and headerless 8-bit PCM (signed or unsigned).  The 
  978. author, John Ball (john.ball@two-t.com) has decided to place the program 
  979. and source code in the public domain.  Playsnd will also play on the PC 
  980. speaker.  Also, Tspak (see above) contains programs to record and play 
  981. .wav files.
  982.  
  983.         Amiga
  984.         -----
  985.  
  986. On the Amiga, OmniPlay by David Champion <dgc3@midway.uchicago.edu>
  987. plays and converts IFF-8SVX, AIFF, WAV, VOC, .au, .snd, and 8 bit raw
  988. (signed, unsigned, u-law) samples.  As of version 1.23, OmniPlay will
  989. also convert any playable sample to 8SVX.  Files: wuarchive.wustl.edu
  990. in /systems/amiga/audio/sampleplayers/oplay123.lha (?)
  991. amiga.physik.unizh.ch in mus/play/oplay123.lha
  992.  
  993.         Apple Macintosh
  994.         ---------------
  995.  
  996. Malcolm Slaney from Apple writes:
  997.  
  998.  "We do have tools to play sound back on most of our Unix hosts.  We wrote
  999.  a program called TcpPlay that lets us read a sound file on a Unix host,
  1000.  open a TCP/IP connection to the Mac on my desk, and plays the file.  We
  1001.  think of it as X windows for sound (at least a step in that direction.)
  1002.  
  1003.  This software is available for anonymous FTP from ftp.apple.com.
  1004.  Look for  ~ftp/pub/TcpPlay/TcpPlay.sit.hqx.
  1005.  
  1006.  Finally, there are MANY tools for working with sound on the Macintosh. Three
  1007.  applications that come to mind immediately are SoundEdit (formerly by
  1008.  Farralon and now by MacroMind/Paracomp), Alchemy and Eric Keller's Signalyze.
  1009.  There are lots of other tools available for sound editing (including some
  1010.  of the QuickTime Movie tools.)"
  1011.  
  1012. Bill Houle sent the following lists:
  1013.  
  1014. Popular commercial apps are indicated with a [*].  All other programs
  1015. mentioned are shareware/freeware available from SUMEX and the various
  1016. mirror sites, or check archie for the nearest FTP location.
  1017.  
  1018. MAC SOUND EDITORS
  1019.  
  1020. Sample Editor [Garrick McFarlane, McFarlaneGA@Kirk.Vax.Aston.Ac.UK]
  1021.   Plays AIFF and 'snd' sounds.  Can convert between AIFF and 'snd'.
  1022.   Can record from built-in mic.  Can add effects such as fade,
  1023.   normalize, delay, etc.
  1024.  
  1025. Wavicle [Lee Fyock]
  1026.   Plays SoundEdit files.  Can convert to 'snd'.  Can record from built-in mic.
  1027.   Can add effects such as fade, filter, reverb, etc.
  1028.  
  1029. [*]SoundEdit/SoundEdit Pro [Farallon/MacroMind*Paracomp]
  1030.   Plays SoundEdit and 'snd' sounds.  Can read/write SoundEdit files and 'snd' 
  1031.   sounds.  Can record from built-in mic.  Can add effects such as
  1032.   echo, filter, reverb, etc.
  1033.  
  1034.  
  1035. MAC SOUND PLAYERS
  1036.  
  1037. Sound-Tracker  [Frank Seide]
  1038.   Plays Amiga SoundTracker files in foreground or background.
  1039.  
  1040. Macintosh Tracker [Thomas R. Lawrance, tomlaw@world.std.com]
  1041.   Plays Amiga SoundTracker files in foreground or background. A port of Marc
  1042.   Espie's Unix Tracker version with Frank Seide's core player thrown in for
  1043.   good measure.
  1044.  
  1045. The Player [Antoine Rosset & Mike Venturi]
  1046.   Plays AIFF, SoundEdit, MOD, and 'snd' files.
  1047.  
  1048. SoundMaster (aka [*]Kaboom!) [Bruce Tomlin]
  1049.   Associates SoundEdit files to MacOS events.
  1050.  
  1051. SndControl [Riccardo Ettore, 72277.1344@compuserve.com]
  1052.   Associates 'snd' sounds to MacOS events.
  1053.  
  1054. Canon 2 [Glenn Anderson, glenn@otago.ac.nz; Jeff Home, jeff@otago.ac.nz]
  1055.   Plays AIFF or 'snd' files in foreground or background.
  1056.  
  1057. Another Mac play/convert program: "It's called SoundApp. I wrote it,
  1058. (franke1@llnl.gov) and it's FreeWare. It will play: SoundCap,
  1059. SoundEdit, WAVE, VOC, MOD, Amiga IFF (8SVX), Sound Designer, AIFF, AU,
  1060. Mac Resource, and DVI ADPCM. It can convert all the above to System 7
  1061. sound resources (except MOD where just the samples are extracted.) And
  1062. it will double buffer."
  1063.  
  1064.  
  1065. The Sound Site Newsletter
  1066. -------------------------
  1067.  
  1068. An electronic publication with lots of info about digitised sound and
  1069. sound formats, albeit mostly on PCs, is "The Sound Site Newsletter",
  1070. maintained by David Komatsu <davek@wasabi.pbrc.hawaii.edu> (this is a
  1071. temporary account until January 1995).  Issue 20 appeared in September
  1072. 1994.  The Sound Site Newsletter (once again!) has its own ftp site:
  1073. sound.usach.cl.
  1074.  
  1075. The Sound Newsletter is posted to: comp.sys.ibm.pc.soundcard
  1076.                                    comp.sys.ibm.pc.misc
  1077.                                    rec.games.misc
  1078. FTP: oak.oakland.edu (misc/sound)
  1079.      garbo.uwasa.fi (pc/sound)
  1080.      sound.usach.cl (pub/Sound/Newsltr) [Home Base]
  1081.  
  1082.  
  1083. Posting sounds
  1084. --------------
  1085.  
  1086. The newsgroup alt.binaries.sounds.misc is dedicated to postings
  1087. containing sound.  (Discussions related to such postings belong in
  1088. alt.binaries.sounds.d.)
  1089.  
  1090. There is no set standard for posting sounds; uuencoded files in most
  1091. popular formats are welcome, if split in parts under 50 kBytes.  To
  1092. accomodate automatic decoding software (such as the ":decode" command
  1093. of the nn newsreader), please place a part indicator of the form
  1094. (mm/nn) at the end of your subject meaning this is number mm of a
  1095. total of nn part.
  1096.  
  1097. It is recommended to post sounds in the format that was used for the
  1098. original recording; conversions to other formats often lose
  1099. information and would do people with identical hardware as the poster
  1100. no favor.  For instance, convering 8-bit linear sound to U-LAW loses
  1101. the lower few bits of the data, and rate changing conversions almost
  1102. always add noise.  Converting from U-LAW to linear requires expansion
  1103. to 16 bit samples if no information loss is allowed!
  1104.  
  1105. U-LAW data is best posted with a NeXT/Sun header.
  1106.  
  1107. If you have to post a file in a headerless format (usually 8-bit
  1108. linear, like ".snd"), please add a description giving at least the
  1109. sampling rate and whether the bytes are signed (zero at 0) or unsigned
  1110. (zero at 0200).  However, it is highly recommended to add a header
  1111. that indicates the sampling rate and encoding scheme; if necessary you
  1112. can use SOX to add a header of your choice to raw data.
  1113.  
  1114. Compression of sound files usually isn't worth it; the standard
  1115. "compress" algorithm doesn't save much when applied to sound data
  1116. (typically at most 10-20 percent), and compression algorithms
  1117. specifically designed for sound (e.g. NeXT's) are usually
  1118. proprietary.  (See also the section "Compression schemes" earlier.)
  1119.  
  1120.  
  1121. Appendices
  1122. ==========
  1123.  
  1124. Here are some more detailed pieces of info that I received by e-mail.
  1125. They are reproduced here virtually without much editing.
  1126.  
  1127. Table of contents
  1128. -----------------
  1129.  
  1130. FTP access for non-internet sites
  1131. AIFF Format (Audio IFF)
  1132. The NeXT/Sun audio file format
  1133. IFF/8SVX Format
  1134. Playing sound on a PC
  1135. The EA-IFF-85 documentation
  1136. US Federal Standard 1016 availability
  1137. Creative Voice (VOC) file format
  1138. RIFF WAVE (.WAV) file format
  1139. U-LAW and A-LAW definitions
  1140. AVR File Format
  1141. The Amiga MOD Format
  1142. The Sample Vision Format
  1143. Some Miscellaneous Formats
  1144. Tandy Deskmate .snd Format Notes
  1145.  
  1146.  
  1147. ------------------------------------------------------------------------
  1148. FTP access for non-internet sites
  1149. ---------------------------------
  1150.  
  1151. From the sci.space FAQ:
  1152.  
  1153.     Sites not connected to the Internet cannot use FTP directly, but
  1154.     there are a few automated FTP servers which operate via email.
  1155.     Send mail containing only the word HELP to ftpmail@decwrl.dec.com
  1156.     or bitftp@pucc.princeton.edu, and the servers will send you
  1157.     instructions on how to make requests.  (The bitftp service is no
  1158.     longer available through UUCP gateways due to complaints about
  1159.     overuse :-( )
  1160.  
  1161. Also:
  1162.  
  1163.     FAQ lists are available by anonymous FTP from rftm.mit.edu
  1164.     and by email from mail-server@rtfm.mit.edu (send a message
  1165.     containing "help" for instructions about the mail server).
  1166.  
  1167.  
  1168. ------------------------------------------------------------------------
  1169. AIFF Format (Audio IFF) and AIFC
  1170. --------------------------------
  1171.  
  1172. This format was developed by Apple for storing high-quality sampled
  1173. sound and musical instrument info; it is also used by SGI and several
  1174. professional audio packages (sorry, I know no names).  An extension,
  1175. called AIFC or AIFF-C, supports compression (see the last item below).
  1176.  
  1177. I've made a BinHex'ed MacWrite version of the AIFF spec (no idea if
  1178. it's the same text as mentioned below) available by anonymous ftp from
  1179. ftp.cwi.nl; the file is /pub/audio/AudioIFF1.2.hqx.  A newer version
  1180. is also available: /pub/audio/AudioIFF1.3.hqx.  But you may be better
  1181. off with the AIFF-C specs, see below.
  1182.  
  1183. Mike Brindley (brindley@ece.orst.edu) writes:
  1184.  
  1185. "The complete AIFF spec by Steve Milne, Matt Deatherage (Apple) is
  1186. available in 'AMIGA ROM Kernal Reference Manual: Devices (3rd Edition)'
  1187. 1991 by Commodore-Amiga, Inc.; Addison-Wesley Publishing Co.; 
  1188. ISBN 0-201-56775-X, starting on page 435 (this edition has a charcoal
  1189. grey cover).  It is available in most bookstores, and soon in many
  1190. good librairies."
  1191.  
  1192. According to Mark Callow (msc@sgi.com):
  1193.  
  1194. A PostScript version of the AIFF-C specification is available via
  1195. anonymous ftp on ftp.sgi.com as /sgi/aiff-c.9.26.91.ps.
  1196.  
  1197. Benjamin Denckla <bdenckla@husc.harvard.edu> writes:
  1198.  
  1199. A piece of information that may be of some use to people who want to use
  1200. AIFF files with their Macintosh Think C programs:  AIFF data structures are
  1201. contained in the file AIFF.h in the "Apple #Includes" folder that comes
  1202. on the distribution disks.  I assume that this header file comes with 
  1203. Apple programming products like MPW [C|C++] as well.  I found this out a 
  1204. little too late: I had already coded my own structures.  These structures 
  1205. of mine, along with other useful code for AIFF-based DSP in C, are 
  1206. available for ftp at ftp.cs.jhu.edu in pub/dsp.
  1207.  
  1208. An important file format for the Mac which is only mentioned once in the
  1209. FAQ is the Sound Designer II file format.  There is also an older Sound
  1210. Designer I format.  I have the SDII format in electronic form but I don't
  1211. think I'm at liberty to distribute it.  It can be obtained by applying to
  1212. become a 3rd Party Developer for Digidesign.  This process is simple
  1213. (1-page application) and free.  Call Digidesign at 415-688-0600 for
  1214. information.  The SDII file format is interesting in that all non-sample
  1215. data (sample rate, channels, etc.) is contained in the resource fork and
  1216. the data fork contains sample data only.
  1217.  
  1218. ------------------------------------------------------------------------
  1219. The NeXT/Sun audio file format
  1220. ------------------------------
  1221.  
  1222. Here's the complete story on the file format, from the NeXT
  1223. documentation.  (Note that the "magic" number is ((int)0x2e736e64),
  1224. which equals ".snd".)  Also, at the end, I've added a litte document
  1225. that someone posted to the net a couple of years ago, that describes
  1226. the format in a bit-by-bit fashion rather than from C.
  1227.  
  1228. I received this from Doug Keislar, NeXT Computer.  This is also the
  1229. Sun format, except that Sun doesn't recognize as many format codes.  I
  1230. added the numeric codes to the table of formats and sorted it.
  1231.  
  1232.  
  1233. SNDSoundStruct:  How a NeXT Computer Represents Sound
  1234.  
  1235. The NeXT sound software defines the SNDSoundStruct structure to  
  1236. represent sound.  This structure defines the soundfile and Mach-O  
  1237. sound segment formats and the sound pasteboard type.  It's also used  
  1238. to describe sounds in Interface Builder.  In addition, each instance  
  1239. of the Sound Kit's Sound class encapsulates a SNDSoundStruct and  
  1240. provides methods to access and modify its attributes.
  1241.  
  1242. Basic sound operations, such as playing, recording, and cut-and-paste  
  1243. editing, are most easily performed by a Sound object.  In many cases,  
  1244. the Sound Kit obviates the need for in-depth understanding of the  
  1245. SNDSoundStruct architecture.  For example, if you simply want to  
  1246. incorporate sound effects into an application, or to provide a simple  
  1247. graphic sound editor (such as the one in the Mail application), you  
  1248. needn't be aware of the details of the SNDSoundStruct.  However, if  
  1249. you want to closely examine or manipulate sound data you should be  
  1250. familiar with this structure.
  1251.  
  1252. The SNDSoundStruct contains a header, information that describes the  
  1253. attributes of a sound, followed by the data (usually samples) that  
  1254. represents the sound.  The structure is defined (in  
  1255. sound/soundstruct.h) as:
  1256.  
  1257. typedef struct {
  1258.     int magic;               /* magic number SND_MAGIC */
  1259.     int dataLocation;        /* offset or pointer to the data */
  1260.     int dataSize;            /* number of bytes of data */
  1261.     int dataFormat;          /* the data format code */
  1262.     int samplingRate;        /* the sampling rate */
  1263.     int channelCount;        /* the number of channels */
  1264.     char info[4];            /* optional text information */
  1265. } SNDSoundStruct;
  1266.  
  1267.  
  1268.  
  1269.  
  1270. SNDSoundStruct Fields
  1271.  
  1272.  
  1273.  
  1274. magic
  1275.  
  1276. magic is a magic number that's used to identify the structure as a  
  1277. SNDSoundStruct.  Keep in mind that the structure also defines the  
  1278. soundfile and Mach-O sound segment formats, so the magic number is  
  1279. also used to identify these entities as containing a sound.
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285. dataLocation
  1286.  
  1287. It was mentioned above that the SNDSoundStruct contains a header  
  1288. followed by sound data.  In reality, the structure only contains the  
  1289. header; the data itself is external to, although usually contiguous  
  1290. with, the structure.  (Nonetheless, it's often useful to speak of the  
  1291. SNDSoundStruct as the header and the data.)  dataLocation is used to  
  1292. point to the data.  Usually, this value is an offset (in bytes) from  
  1293. the beginning of the SNDSoundStruct to the first byte of sound data.   
  1294. The data, in this case, immediately follows the structure, so  
  1295. dataLocation can also be thought of as the size of the structure's  
  1296. header.  The other use of dataLocation, as an address that locates  
  1297. data that isn't contiguous with the structure, is described in  
  1298. "Format Codes," below.
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304. dataSize, dataFormat, samplingRate, and channelCount
  1305.  
  1306. These fields describe the sound data.
  1307.  
  1308. dataSize is its size in bytes (not including the size of the  
  1309. SNDSoundStruct).
  1310.  
  1311. dataFormat is a code that identifies the type of sound.  For sampled  
  1312. sounds, this is the quantization format.  However, the data can also  
  1313. be instructions for synthesizing a sound on the DSP.  The codes are  
  1314. listed and explained in "Format Codes," below.
  1315.  
  1316. samplingRate is the sampling rate (if the data is samples).  Three  
  1317. sampling rates, represented as integer constants, are supported by  
  1318. the hardware:
  1319.  
  1320. Constant        Sampling Rate (samples/sec) 
  1321.  
  1322. SND_RATE_CODEC  8012.821        (CODEC input)
  1323. SND_RATE_LOW    22050.0 (low sampling rate output)
  1324. SND_RATE_HIGH   44100.0 (high sampling rate output)
  1325.  
  1326. channelCount is the number of channels of sampled sound.
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332. info
  1333.  
  1334. info is a NULL-terminated string that you can supply to provide a  
  1335. textual description of the sound.  The size of the info field is set  
  1336. when the structure is created and thereafter can't be enlarged.  It's  
  1337. at least four bytes long (even if it's unused).
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343. Format Codes
  1344.  
  1345. A sound's format is represented as a positive 32-bit integer.  NeXT  
  1346. reserves the integers 0 through 255; you can define your own format  
  1347. and represent it with an integer greater than 255.  Most of the  
  1348. formats defined by NeXT describe the amplitude quantization of  
  1349. sampled sound data:
  1350.  
  1351. Value   Code    Format 
  1352.  
  1353. 0       SND_FORMAT_UNSPECIFIED  unspecified format 
  1354. 1       SND_FORMAT_MULAW_8      8-bit mu-law samples
  1355. 2       SND_FORMAT_LINEAR_8     8-bit linear samples
  1356. 3       SND_FORMAT_LINEAR_16    16-bit linear samples
  1357. 4       SND_FORMAT_LINEAR_24    24-bit linear samples
  1358. 5       SND_FORMAT_LINEAR_32    32-bit linear samples
  1359. 6       SND_FORMAT_FLOAT        floating-point samples
  1360. 7       SND_FORMAT_DOUBLE       double-precision float samples
  1361. 8       SND_FORMAT_INDIRECT     fragmented sampled data
  1362. 9       SND_FORMAT_NESTED       ?
  1363. 10      SND_FORMAT_DSP_CORE     DSP program
  1364. 11      SND_FORMAT_DSP_DATA_8   8-bit fixed-point samples
  1365. 12      SND_FORMAT_DSP_DATA_16  16-bit fixed-point samples
  1366. 13      SND_FORMAT_DSP_DATA_24  24-bit fixed-point samples
  1367. 14      SND_FORMAT_DSP_DATA_32  32-bit fixed-point samples
  1368. 15      ?
  1369. 16      SND_FORMAT_DISPLAY      non-audio display data
  1370. 17      SND_FORMAT_MULAW_SQUELCH        ?
  1371. 18      SND_FORMAT_EMPHASIZED   16-bit linear with emphasis
  1372. 19      SND_FORMAT_COMPRESSED   16-bit linear with compression
  1373. 20      SND_FORMAT_COMPRESSED_EMPHASIZED        A combination of the two above
  1374. 21      SND_FORMAT_DSP_COMMANDS Music Kit DSP commands
  1375. 22      SND_FORMAT_DSP_COMMANDS_SAMPLES         ?
  1376. [Some new ones supported by Sun.  This is all I currently know. --GvR]
  1377. 23      SND_FORMAT_ADPCM_G721
  1378. 24      SND_FORMAT_ADPCM_G722
  1379. 25      SND_FORMAT_ADPCM_G723_3
  1380. 26      SND_FORMAT_ADPCM_G723_5
  1381. 27      SND_FORMAT_ALAW_8
  1382.  
  1383.  
  1384. Most formats identify different sizes and types of  
  1385. sampled data.  Some deserve special note:  
  1386.  
  1387.  
  1388. --      SND_FORMAT_DSP_CORE format contains data that represents a  
  1389. loadable DSP core program.  Sounds in this format are required by the  
  1390. SNDBootDSP() and SNDRunDSP() functions.  You create a  
  1391. SND_FORMAT_DSP_CORE sound by reading a DSP load file (extension  
  1392. ".lod") with the SNDReadDSPfile() function.
  1393.  
  1394. --      SND_FORMAT_DSP_COMMANDS is used to distinguish sounds that  
  1395. contain DSP commands created by the Music Kit.  Sounds in this format  
  1396. can only be created through the Music Kit's Orchestra class, but can  
  1397. be played back through the SNDStartPlaying() function.
  1398.  
  1399. --      SND_FORMAT_DISPLAY format is used by the Sound Kit's  
  1400. SoundView class.  Such sounds can't be played.  
  1401.  
  1402.  
  1403. --      SND_FORMAT_INDIRECT indicates data that has become  
  1404. fragmented, as described in a separate section, below.  
  1405.  
  1406.  
  1407. --      SND_FORMAT_UNSPECIFIED is used for unrecognized formats.
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413. Fragmented Sound Data
  1414.  
  1415. Sound data is usually stored in a contiguous block of memory.   
  1416. However, when sampled sound data is edited (such that a portion of  
  1417. the sound is deleted or a portion inserted), the data may become  
  1418. discontiguous, or fragmented.  Each fragment of data is given its own  
  1419. SNDSoundStruct header; thus, each fragment becomes a separate  
  1420. SNDSoundStruct structure.  The addresses of these new structures are  
  1421. collected into a contiguous, NULL-terminated block; the dataLocation  
  1422. field of the original SNDSoundStruct is set to the address of this  
  1423. block, while the original format, sampling rate, and channel count  
  1424. are copied into the new SNDSoundStructs.  
  1425.  
  1426.  
  1427. Fragmentation serves one purpose:  It avoids the high cost of moving  
  1428. data when the sound is edited.  Playback of a fragmented sound is  
  1429. transparent-you never need to know whether the sound is fragmented  
  1430. before playing it.  However, playback of a heavily fragmented sound  
  1431. is less efficient than that of a contiguous sound.  The  
  1432. SNDCompactSamples() C function can be used to compact fragmented  
  1433. sound data.
  1434.  
  1435. Sampled sound data is naturally unfragmented.  A sound that's freshly  
  1436. recorded or retrieved from a soundfile, the Mach-O segment, or the  
  1437. pasteboard won't be fragmented.  Keep in mind that only sampled data  
  1438. can become fragmented.
  1439.  
  1440.  
  1441.  
  1442. _________________________
  1443. >From mentor.cc.purdue.edu!purdue!decwrl!ucbvax!ziploc!eps Wed Apr  4  
  1444. 23:56:23 EST 1990
  1445. Article 5779 of comp.sys.next:
  1446. Path: mentor.cc.purdue.edu!purdue!decwrl!ucbvax!ziploc!eps
  1447. >From: eps@toaster.SFSU.EDU (Eric P. Scott)
  1448. Newsgroups: comp.sys.next
  1449. Subject: Re: Format of NeXT sndfile headers?
  1450. Message-ID: <445@toaster.SFSU.EDU>
  1451. Date: 31 Mar 90 21:36:17 GMT
  1452. References: <14978@phoenix.Princeton.EDU>
  1453. Reply-To: eps@cs.SFSU.EDU (Eric P. Scott)
  1454. Organization: San Francisco State University
  1455. Lines: 42
  1456.  
  1457. In article <14978@phoenix.Princeton.EDU>
  1458.         bskendig@phoenix.Princeton.EDU (Brian Kendig) writes:
  1459. >I'd like to take a program I have that converts Macintosh sound  
  1460. files
  1461. >to NeXT sndfiles and polish it up a bit to go the other direction as
  1462. >well.
  1463.  
  1464. Two people have already submitted programs that do this
  1465. (Christopher Lane and Robert Hood); check the various
  1466. NeXT archive sites.
  1467.  
  1468. >       Could someone please give me the format of a NeXT sndfile
  1469. >header?
  1470.  
  1471. "big-endian"
  1472.         0       1       2       3
  1473.         +-------+-------+-------+-------+
  1474. 0       | 0x2e  | 0x73  | 0x6e  | 0x64  |       "magic" number
  1475.         +-------+-------+-------+-------+
  1476. 4       |                               |       data location
  1477.         +-------+-------+-------+-------+
  1478. 8       |                               |       data size
  1479.         +-------+-------+-------+-------+
  1480. 12      |                               |       data format (enum)
  1481.         +-------+-------+-------+-------+
  1482. 16      |                               |       sampling rate (int)
  1483.         +-------+-------+-------+-------+
  1484. 20      |                               |       channel count
  1485.         +-------+-------+-------+-------+
  1486. 24      |       |       |       |       |       (optional) info  
  1487. string
  1488.  
  1489. 28 = minimum value for data location
  1490.  
  1491. data format values can be found in /usr/include/sound/soundstruct.h
  1492.  
  1493. Most common combinations:
  1494.  
  1495.          sampling  channel    data
  1496.              rate    count  format              
  1497. voice file   8012        1       1 =  8-bit mu-law
  1498. system beep 22050        2       3 = 16-bit linear
  1499. CD-quality  44100        2       3 = 16-bit linear
  1500.  
  1501. ------------------------------------------------------------------------
  1502. IFF/8SVX Format
  1503. ---------------
  1504.  
  1505. Newsgroups: alt.binaries.sounds.d,alt.sex.sounds
  1506. Subject: Format of the IFF header (Amiga sounds)
  1507. Message-ID: <2509@tardis.Tymnet.COM>
  1508. From: jms@tardis.Tymnet.COM (Joe Smith)
  1509. Date: 23 Oct 91 23:54:38 GMT
  1510. Followup-To: alt.binaries.sounds.d
  1511. Organization: BT North America (Tymnet)
  1512.  
  1513. The first 12 bytes of an IFF file are used to distinguish between an Amiga
  1514. picture (FORM-ILBM), an Amiga sound sample (FORM-8SVX), or other file
  1515. conforming to the IFF specification.  The middle 4 bytes is the count of
  1516. bytes that follow the "FORM" and byte count longwords.  (Numbers are stored
  1517. in M68000 form, high order byte first.)
  1518.  
  1519.                 ------------------------------------------
  1520.  
  1521. FutureSound audio file, 15000 samples at 10.000KHz, file is 15048 bytes long.
  1522.  
  1523. 0000: 464F524D 00003AC0 38535658 56484452    FORM..:.8SVXVHDR
  1524.       F O R M     15040 8 S V X  V H D R
  1525. 0010: 00000014 00003A98 00000000 00000000    ......:.........
  1526.             20    15000        0        0
  1527. 0020: 27100100 00010000 424F4459 00003A98    '.......BODY..:.
  1528.      10000 1 0    1.0   B O D Y     15000
  1529.  
  1530. 0000000..03 = "FORM", identifies this as an IFF format file.
  1531. FORM+00..03 (ULONG) = number of bytes that follow.  (Unsigned long int.)
  1532. FORM+03..07 = "8SVX", identifies this as an 8-bit sampled voice.
  1533.  
  1534. ????+00..03 = "VHDR", Voice8Header, describes the parameters for the BODY.
  1535. VHDR+00..03 (ULONG) = number of bytes to follow. 
  1536. VHDR+04..07 (ULONG) = samples in the high octave 1-shot part.
  1537. VHDR+08..0B (ULONG) = samples in the high octave repeat part.
  1538. VHDR+0C..0F (ULONG) = samples per cycle in high octave (if repeating), else 0.
  1539. VHDR+10..11 (UWORD) = samples per second.  (Unsigned 16-bit quantity.)
  1540. VHDR+12     (UBYTE) = number of octaves of waveforms in sample.
  1541. VHDR+13     (UBYTE) = data compression (0=none, 1=Fibonacci-delta encoding).
  1542. VHDR+14..17 (FIXED) = volume.  (The number 65536 means 1.0 or full volume.)
  1543.  
  1544. ????+00..03 = "BODY", identifies the start of the audio data.
  1545. BODY+00..03 (ULONG) = number of bytes to follow.
  1546. BODY+04..NNNNN      = Data, signed bytes, from -128 to +127.
  1547.  
  1548. 0030: 04030201 02030303 04050605 05060605
  1549. 0040: 06080806 07060505 04020202 01FF0000
  1550. 0050: 00000000 FF00FFFF FFFEFDFD FDFEFFFF
  1551. 0060: FDFDFF00 00FFFFFF 00000000 00FFFF00
  1552. 0070: 00000000 00FF0000 00FFFEFF 00000000
  1553. 0080: 00010000 000101FF FF0000FE FEFFFFFE
  1554. 0090: FDFDFEFD FDFFFFFC FDFEFDFD FEFFFEFE
  1555. 00A0: FFFEFEFE FEFEFEFF FFFFFEFF 00FFFF01
  1556.  
  1557. This small section of the audio sample shows the number ranging from -5 (0xFD)
  1558. to +8 (0x08).  Warning: Do not assume that the BODY starts 48 bytes into the
  1559. file.  In addition to "VHDR", chunks labeled "NAME", "AUTH", "ANNO", or 
  1560. "(c) " may be present, and may be in any order.  You will have to check the
  1561. byte count in each chunk to determine how many bytes to skip.
  1562.  
  1563. ------------------------------------------------------------------------
  1564. Playing sound on a PC
  1565. ---------------------
  1566.  
  1567. From: Eric A Rasmussen
  1568.  
  1569. Any turbo PC (8088 at 8 Mhz or greater)/286/386/486/etc. can produce a quality
  1570. playback of single channel 8 bit sounds on the internal (1 bit, 1 channel)
  1571. speaker by utilizing Pulse-Width-Modulation, which toggles the speaker faster
  1572. than it can physically move to simulate positions between fully on and fully
  1573. off.  There are several PD programs of this nature that I know of:
  1574.  
  1575. REMAC  - Plays MAC format sound files.  Files on the Macintosh, at least the
  1576.          sound files that I've ripped apart, seem to contain 3 parts.  The
  1577.          first two are info like what the file icon looks like and other
  1578.          header type info.  The third part contains the raw sample data, and
  1579.          it is this portion of the file which is saved to a seperate file,
  1580.          often named with the .snd extension by PC users.  Personally, I like
  1581.          to name the files .s1, .s2, .s3, or .s4 to indicate the sampling rate
  1582.          of the file. (-s# is how to specify the playback rate in REMAC.)
  1583.          REMAC provides playback rates of 5550hz, 7333hz, 11 khz, & 22 khz.
  1584. REMAC2 - Same as REMAC, but sounds better on higher speed machines.
  1585. REPLAY - Basically same as REMAC, but for playback of Atari ST sounds. 
  1586.          Apparently, the Atari has two sound formats, one of which sounds like
  1587.          garbage if played by REMAC or REPLAY in the incorrect mode.  The
  1588.          other file format works fine with REMAC and so appears to be 'normal'
  1589.          unsigned 8-bit data.  REPLAY provides playback rates of 11.5 khz,
  1590.          12.5 khz, 14 khz, 16 khz, 18.5 khz, 22khz, & 27 khz.
  1591.  
  1592. These three programs are all by the same author, Richard E. Zobell who does
  1593. not have an internet mail address to my knowledge, but does have a GEnie email
  1594. address of R.ZOBELL. 
  1595.  
  1596. Additionally, there are various stand-alone demos which use the internal
  1597. speaker, of which there is one called mushroom which plays a 30 second
  1598. advertising jingle for magic mushroom room deoderizers which is pretty
  1599. humerous.  I've used this player to playback samples that I ripped out of the
  1600. commercial game program Mean Streets, which uses something they call RealSound
  1601. (tm) to playback digital samples on the internal speaker. (Of course, I only do
  1602. this on my own system, and since I own the game, I see no problems with it.)
  1603.  
  1604. For owners of 8 Mhz 286's and above, the option to play 4 channel 8 bit sounds
  1605. (with decent quality) on the internal speaker is also a reality.  Quite a
  1606. number of PD programs exist to do this, including, but not limited to:
  1607.  
  1608. ModEdit, ModPlay, ScreamTracker, STM, Star Trekker, Tetra, and probably a few
  1609. more.  
  1610.  
  1611. All these programs basically make use of various sound formats used by the
  1612. Amiga line of computers.  These include .stm files, .mod files
  1613. [a.k.a. mod. files], and .nst files [really the same hing].  Also,
  1614. these programs pretty much all have the option to playback the 
  1615. sound to add-on hardware such as the SoundBlaster card, the Covox series of
  1616. devices, and also to direct the data to either one or two (for stereo)
  1617. parallel ports, which you could attach your own D/A's to.  (From what I have
  1618. seen, the Covox is basically an small amplified speaker with a D/A which plugs
  1619. into the parallel port.  This sounds very similiar to the Disney Sound System
  1620. (DSS) which people have been talking about recently.)  
  1621.  
  1622. ------------------------------------------------------------------------
  1623. The EA-IFF-85 documentation
  1624. ---------------------------
  1625.  
  1626. From: dgc3@midway.uchicago.edu
  1627.  
  1628. As promised, here's an ftp location for the EA-IFF-85 documentation.  It's
  1629. the November 1988 release as revised by Commodore (the last public release),
  1630. with specifications for IFF FORMs for graphics, sound, formatted text, and
  1631. more.  IFF FORMS now exist for other media, including structured drawing, and
  1632. new documentation is now available only from Commodore.
  1633.  
  1634. The documentation is at grind.isca.uiowa.edu, in the directory
  1635. /amiga/f1/ff185.  The complete file list is as follows:
  1636.  
  1637. DOCUMENTS.zoo    
  1638. EXAMPLES.zoo     
  1639. EXECUTABLE.zoo   
  1640. INCLUDE.zoo      
  1641. LINKER_INFO.zoo  
  1642. OBJECT.zoo       
  1643. SOURCE.zoo       
  1644. TP_IFF_Specs.zoo 
  1645.  
  1646. All files except DOCUMENTS.zoo are Amiga-specific, but may be used as a basis
  1647. for conversion to other platforms.  Well, I take that tentatively back.  I
  1648. don't know what TP_IFF_Specs.zoo contains, so it might be non-Amiga-specific.
  1649.  
  1650. ------------------------------------------------------------------------
  1651. US Federal Standard 1016 availability
  1652. -------------------------------------
  1653.  
  1654. From: jpcampb@afterlife.ncsc.mil (Joe Campbell)
  1655.  
  1656. The U.S. DoD's Federal-Standard-1016 based 4800 bps code excited linear
  1657. prediction voice coder version 3.2 (CELP 3.2) Fortran and C simulation
  1658. source codes are available for worldwide distribution (on DOS
  1659. diskettes, but configured to compile on Sun SPARC stations) from NTIS
  1660. and DTIC.  Example input and processed speech files are included.  A
  1661. Technical Information Bulletin (TIB), "Details to Assist in
  1662. Implementation of Federal Standard 1016 CELP," and the official
  1663. standard, "Federal Standard 1016, Telecommunications:  Analog to
  1664. Digital Conversion of Radio Voice by 4,800 bit/second Code Excited
  1665. Linear Prediction (CELP)," are also available.
  1666.  
  1667. This is available through the National Technical Information Service:
  1668.  
  1669. NTIS
  1670. U.S. Department of Commerce
  1671. 5285 Port Royal Road
  1672. Springfield, VA  22161
  1673. USA
  1674. (703) 487-4650
  1675.  
  1676. The "AD" ordering number for the CELP software is AD M000 118
  1677. (US$ 90.00) and for the TIB it's AD A256 629 (US$ 17.50).  The LPC-10
  1678. standard, described below, is FIPS Pub 137 (US$ 12.50).  There is a
  1679. $3.00 shipping charge on all U.S. orders.  The telephone number for
  1680. their automated system is 703-487-4650, or 703-487-4600 if you'd prefer
  1681. to talk with a real person.
  1682.  
  1683. (U.S. DoD personnel and contractors can receive the package from the
  1684. Defense Technical Information Center:  DTIC, Building 5, Cameron
  1685. Station, Alexandria, VA 22304-6145.  Their telephone number is
  1686. 703-274-7633.)
  1687.  
  1688. The following articles describe the Federal-Standard-1016 4.8-kbps CELP
  1689. coder (it's unnecessary to read more than one):
  1690.  
  1691. Campbell, Joseph P. Jr., Thomas E. Tremain and Vanoy C. Welch,
  1692. "The Federal Standard 1016 4800 bps CELP Voice Coder," Digital Signal
  1693. Processing, Academic Press, 1991, Vol. 1, No. 3, p. 145-155.
  1694.  
  1695. Campbell, Joseph P. Jr., Thomas E. Tremain and Vanoy C. Welch,
  1696. "The DoD 4.8 kbps Standard (Proposed Federal Standard 1016),"
  1697. in Advances in Speech Coding, ed. Atal, Cuperman and Gersho,
  1698. Kluwer Academic Publishers, 1991, Chapter 12, p. 121-133.
  1699.  
  1700. Campbell, Joseph P. Jr., Thomas E. Tremain and Vanoy C. Welch, "The
  1701. Proposed Federal Standard 1016 4800 bps Voice Coder:  CELP," Speech
  1702. Technology Magazine, April/May 1990, p. 58-64.
  1703.  
  1704.  
  1705. The U.S. DoD's Federal-Standard-1015/NATO-STANAG-4198 based 2400 bps
  1706. linear prediction coder (LPC-10) was republished as a Federal
  1707. Information Processing Standards Publication 137 (FIPS Pub 137).
  1708. It is described in:
  1709.  
  1710. Thomas E. Tremain, "The Government Standard Linear Predictive Coding
  1711. Algorithm:  LPC-10," Speech Technology Magazine, April 1982, p. 40-49.
  1712.  
  1713. There is also a section about FS-1015 in the book:
  1714. Panos E. Papamichalis, Practical Approaches to Speech Coding,
  1715. Prentice-Hall, 1987.
  1716.  
  1717. The voicing classifier used in the enhanced LPC-10 (LPC-10e) is described in:
  1718. Campbell, Joseph P., Jr. and T. E. Tremain, "Voiced/Unvoiced Classification
  1719. of Speech with Applications to the U.S. Government LPC-10E Algorithm,"
  1720. Proceedings of the IEEE International Conference on Acoustics, Speech, and
  1721. Signal Processing, 1986, p. 473-6.
  1722.  
  1723. Copies of the official standard
  1724. "Federal Standard 1016, Telecommunications: Analog to Digital Conversion
  1725. of Radio Voice by 4,800 bit/second Code Excited Linear Prediction (CELP)"
  1726. are available for US$ 5.00 each from:
  1727.  
  1728. GSA Federal Supply Service Bureau
  1729. Specification Section, Suite 8100
  1730. 470 E. L'Enfant Place, S.W.
  1731. Washington, DC  20407
  1732. (202)755-0325
  1733.  
  1734. Realtime DSP code for FS-1015 and FS-1016 is sold by:
  1735.  
  1736. John DellaMorte
  1737. DSP Software Engineering
  1738. 165 Middlesex Tpk, Suite 206
  1739. Bedford, MA  01730
  1740. USA
  1741. 1-617-275-3733
  1742. 1-617-275-4323 (fax)
  1743. dspse.bedford@channel1.com
  1744.  
  1745. DSP Software Engineering's FS-1016 code can run on a DSP Research's Tiger 30
  1746. (a PC board with a TMS320C3x and analog interface suited to development work).
  1747.  
  1748. DSP Research                
  1749. 1095 E. Duane Ave.          
  1750. Sunnyvale, CA  94086        
  1751. USA
  1752. (408)773-1042               
  1753. (408)736-3451 (fax)         
  1754.  
  1755. From: cfreese@super.org (Craig F. Reese)
  1756. Newsgroups: comp.speech,comp.dsp,comp.compression.research
  1757. Subject: CELP 3.2a release now available
  1758. Organization: Supercomputing Research Center (Bowie, MD)
  1759. Date: Tue, 3 Aug 1993 14:55:25 GMT
  1760.  
  1761. 3 August 1993
  1762.  
  1763. CELP 3.2a Release
  1764.  
  1765. Dear CELPers,
  1766.  
  1767. We have placed an updated version of the FS-1016 CELP 3.2 code in the
  1768. anonymous FTP area on super.org.  It's in:
  1769.  
  1770.   /pub/celp_3.2a.tar.Z (please be sure to do the ftp in binary mode).
  1771.  
  1772. This is essentially the PC release that was on fumar, except that we
  1773. started directly from the PC disks.  The value added is that we have
  1774. made over 69 corrections and fixes.  Most of these were necessary
  1775. because of the 8 character file name limit on DOS, but there are some
  1776. others, as well.
  1777.  
  1778. The code (C, FORTRAN, diskio) all has been built and tested on a Sun4
  1779. under SunOS4.1.3.  If you want to run it somewhere else, then you may
  1780. have to do a bit of work.  (A Solaris 2.x-compatible release is
  1781. planned soon.)
  1782.  
  1783. [One note to PCers.  The files:
  1784. [
  1785. [       cbsearch.F celp.F csub.F mexcite.F psearch.F
  1786. [
  1787. [are meant to be passed through the C preprocessor (cpp).
  1788. [We gather that DOS (or whatever it's called) can't distinguish 
  1789. [the .F from a .f.  Be careful!
  1790.  
  1791. Very limited support is available from the authors (Joe, et al.).
  1792. Please do not send questions or suggestions without first reading the
  1793. documentation (README files, the Technical Information Bulletin, etc.).
  1794. The authors would enjoy hearing from you, but they have limited time
  1795. for support and would like to use it as efficiently as possible.  They
  1796. welcome bug reports, but, again, please read the documentation first.
  1797. All users of FS-1016 CELP software are strongly encouraged to acquire
  1798. the latest release (version 3.2a as of this writing).
  1799.  
  1800. We do not know how long we will be able to leave the software on this
  1801. site, but it should be _at_least_ through 1 October 1993 (if you find
  1802. it missing, please drop me (Craig) a note).  Please try to get the
  1803. software during off hours (8 p.m. - 7 a.m. Eastern Standard time) or
  1804. folks here might complain and we'll have to get rid of the code (if
  1805. that happens, we'll try to pass it on to someone else, who can put it
  1806. on the net).  We would be more than happy for someone to copy it and
  1807. make it available elsewhere.
  1808.  
  1809. Good Luck,
  1810.  
  1811. Craig F. Reese  (cfreese@super.org)
  1812. IDA/Supercomputing Research Center
  1813.  
  1814. Joe Campbell (jpcampb@afterlife.ncsc.mil)
  1815. Department of Defense
  1816.  
  1817. P.S.  Just so you all know, I (Craig) am not actually involved in
  1818. CELP work.  I mainly got with Joe to help make the software available
  1819. on the Internet.  In the course of doing so, I cleaned up much of it,
  1820. but I am not, by any stretch, a CELP expert and will most likely
  1821. be unable to answer any technical questions concerning it. ;^)
  1822.  
  1823. From: tobiasr@monolith.lrmsc.loral.com (Richard Tobias)
  1824.  
  1825. For U.S. FED-STD-1016 (4800 bps CELP) _realtime_ DSP code and
  1826. information about products using this code using the AT&T DSP32C and
  1827. AT&T DSP3210, contact:
  1828.  
  1829. White Eagle Systems Technology, Inc.
  1830. 1123 Queensbridge Way
  1831. San Jose, CA 95120
  1832. (408) 997-2706
  1833. (408) 997-3584 (fax)
  1834. rjjt@netcom.com
  1835.  
  1836. From: Cole Erskine <cole@analogical.com>
  1837.  
  1838. [paraphrased]
  1839.  
  1840. Analogical Systems has a _real-time_ multirate implementation of U.S.
  1841. Federal Standard 1016 CELP operating at bit rates of 4800, 7200, and
  1842. 9600 bps on a single 27MHz Motorola DSP56001. Source and object code
  1843. is available for a one-time license fee.
  1844.  
  1845. FREE, _real-time_ demonstration software for the Ariel PC-56D is
  1846. available for those who already have such a board by contacting
  1847. Analogical Systems.  The demo software allows you to record and
  1848. playback CELP files to and from the PC's hard disk.
  1849.  
  1850. Analogical Systems
  1851. 2916 Ramona Street
  1852. Palo Alto, CA 94306
  1853. Tel: +1 (415) 323-3232
  1854. FAX: +1 (415) 323-4222
  1855.  
  1856. ------------------------------------------------------------------------
  1857. Creative Voice (VOC) file format
  1858. --------------------------------
  1859.  
  1860. From: galt@dsd.es.com
  1861.  
  1862. (byte numbers are hex!)
  1863.  
  1864.     HEADER (bytes 00-19)
  1865.     Series of DATA BLOCKS (bytes 1A+) [Must end w/ Terminator Block]
  1866.  
  1867. - ---------------------------------------------------------------
  1868.  
  1869. HEADER:
  1870. -------
  1871.      byte #     Description
  1872.      ------     ------------------------------------------
  1873.      00-12      "Creative Voice File"
  1874.      13         1A (eof to abort printing of file)
  1875.      14-15      Offset of first datablock in .voc file (std 1A 00
  1876.                 in Intel Notation)
  1877.      16-17      Version number (minor,major) (VOC-HDR puts 0A 01)
  1878.      18-19      2's Comp of Ver. # + 1234h (VOC-HDR puts 29 11)
  1879.  
  1880. - ---------------------------------------------------------------
  1881.  
  1882. DATA BLOCK:
  1883. -----------
  1884.  
  1885.    Data Block:  TYPE(1-byte), SIZE(3-bytes), INFO(0+ bytes)
  1886.    NOTE: Terminator Block is an exception -- it has only the TYPE byte.
  1887.  
  1888.       TYPE   Description     Size (3-byte int)   Info
  1889.       ----   -----------     -----------------   -----------------------
  1890.       00     Terminator      (NONE)              (NONE)
  1891.       01     Sound data      2+length of data    *
  1892.       02     Sound continue  length of data      Voice Data
  1893.       03     Silence         3                   **
  1894.       04     Marker          2                   Marker# (2 bytes)
  1895.       05     ASCII           length of string    null terminated string
  1896.       06     Repeat          2                   Count# (2 bytes)
  1897.       07     End repeat      0                   (NONE)
  1898.       08     Extended        4                   ***
  1899.  
  1900.       *Sound Info Format:       **Silence Info Format:
  1901.        ---------------------      ----------------------------
  1902.        00   Sample Rate           00-01  Length of silence - 1
  1903.        01   Compression Type      02     Sample Rate
  1904.        02+  Voice Data
  1905.  
  1906.     ***Extended Info Format:
  1907.        ---------------------
  1908.        00-01  Time Constant: Mono: 65536 - (256000000/sample_rate)
  1909.                              Stereo: 65536 - (25600000/(2*sample_rate))
  1910.        02     Pack
  1911.        03     Mode: 0 = mono
  1912.                     1 = stereo
  1913.  
  1914.  
  1915.   Marker#           -- Driver keeps the most recent marker in a status byte
  1916.   Count#            -- Number of repetitions + 1
  1917.                          Count# may be 1 to FFFE for 0 - FFFD repetitions
  1918.                          or FFFF for endless repetitions
  1919.   Sample Rate       -- SR byte = 256-(1000000/sample_rate)
  1920.   Length of silence -- in units of sampling cycle
  1921.   Compression Type  -- of voice data
  1922.                          8-bits    = 0
  1923.                          4-bits    = 1
  1924.                          2.6-bits  = 2
  1925.                          2-bits    = 3
  1926.                          Multi DAC = 3+(# of channels) [interesting--
  1927.                                        this isn't in the developer's manual]
  1928.  
  1929. Detailed description of new data blocks (VOC files version 1.20 and above):
  1930.  
  1931.         (Source is fax from Barry Boone at Creative Labs, 405/742-6622)
  1932.  
  1933. BLOCK 8 - digitized sound attribute extension, must preceed block 1.
  1934.           Used to define stereo, 8 bit audio
  1935.         BYTE bBlockID;       // = 8
  1936.         BYTE nBlockLen[3];   // 3 byte length
  1937.         WORD wTimeConstant;  // time constant = same as block 1
  1938.         BYTE bPackMethod;    // same as in block 1
  1939.         BYTE bVoiceMode;     // 0-mono, 1-stereo
  1940.  
  1941.         Data is stored left, right
  1942.  
  1943. BLOCK 9 - data block that supersedes blocks 1 and 8.  
  1944.           Used for stereo, 16 bit.
  1945.  
  1946.         BYTE bBlockID;          // = 9
  1947.         BYTE nBlockLen[3];      // length 12 plus length of sound
  1948.         DWORD dwSamplesPerSec;  // samples per second, not time const.
  1949.         BYTE bBitsPerSample;    // e.g., 8 or 16
  1950.         BYTE bChannels;         // 1 for mono, 2 for stereo
  1951.         WORD wFormat;           // see below
  1952.         BYTE reserved[4];       // pad to make block w/o data 
  1953.                                 // have a size of 16 bytes
  1954.  
  1955.         Valid values of wFormat are:
  1956.  
  1957.                 0x0000  8-bit unsigned PCM
  1958.                 0x0001  Creative 8-bit to 4-bit ADPCM
  1959.                 0x0002  Creative 8-bit to 3-bit ADPCM
  1960.                 0x0003  Creative 8-bit to 2-bit ADPCM
  1961.                 0x0004  16-bit signed PCM
  1962.                 0x0006  CCITT a-Law
  1963.                 0x0007  CCITT u-Law
  1964.                 0x02000 Creative 16-bit to 4-bit ADPCM
  1965.  
  1966.         Data is stored left, right
  1967.  
  1968. ------------------------------------------------------------------------
  1969. RIFF WAVE (.WAV) file format
  1970. ----------------------------
  1971.  
  1972. RIFF is a format by Microsoft and IBM which is similar in spirit and
  1973. functionality as EA-IFF-85, but not compatible (and it's in
  1974. little-endian byte order, of course :-).  WAVE is RIFF's equivalent of
  1975. AIFF, and its inclusion in Microsoft Windows 3.1 has suddenly made it
  1976. important to know about.
  1977.  
  1978. Rob Ryan was kind enough to send me a description of the RIFF format.
  1979. Unfortunately, it is too big to include here (27 k), but I've made it
  1980. available for anonymous ftp as ftp.cwi.nl:/pub/audio/RIFF-format.
  1981.  
  1982. The complete definition of the WAVE file format as defined by IBM and
  1983. Microsoft is available for anonymous FTP from ftp.microsoft.com, in
  1984. directory developer/MSDN/CD8 as file RIFFNE.ZIP, which contains a MS
  1985. help file (riffne.hlp).
  1986.  
  1987. Mark Stout <marks@crystal.cirrus.com> clarifies: RIFFNE.HLP,
  1988. Multimedia Standards Update: New Multimedia Data Types and Data
  1989. Techniques 2.1.0, has only extensions onto the original Multimedia
  1990. Programming Interface and Data Specifications 1.0, which Bob Ryan has
  1991. made an excerpt from.  Most people only need the original spec (Bob
  1992. Ryan's excerpt).  However, for information on most compressed audio
  1993. formats, they should obtain RIFFNE.HLP.
  1994.  
  1995. Conor Frederick Prischmann <conor@owlnet.rice.edu> points to two more
  1996. sites:
  1997.  
  1998. (1)     Take a look at ftp site : teeri.ouli.fi   
  1999.                in the directory : /pub/msdos/programming/*
  2000.         it has some sub dirs like specs, utils and most importantly
  2001.         gpe.  Take that file and you know everything.
  2002.  
  2003. (2)     ftp.ircam.fr:/pub/music
  2004.  
  2005. ------------------------------------------------------------------------
  2006. U-LAW and A-LAW definitions
  2007. ---------------------------
  2008.  
  2009. [Adapted from information provided by duggan@cc.gatech.edu (Rick
  2010. Duggan) and davep@zenobia.phys.unsw.EDU.AU (David Perry)]
  2011.  
  2012. u-LAW (really mu-LAW) is
  2013.  
  2014.           sgn(m)   (     |m |)       |m |
  2015.    y=    ------- ln( 1+ u|--|)       |--| =< 1
  2016.          ln(1+u)   (     |mp|)       |mp|         
  2017.  
  2018. A-LAW is
  2019.  
  2020.      |     A    (m )                 |m |    1
  2021.      |  ------- (--)                 |--| =< - 
  2022.      |  1+ln A  (mp)                 |mp|    A     
  2023.    y=|
  2024.      | sgn(m) (        |m |)    1    |m |
  2025.      | ------ ( 1+ ln A|--|)    - =< |--| =< 1
  2026.      | 1+ln A (        |mp|)    A    |mp|         
  2027.  
  2028. Values of u=100 and 255, A=87.6, mp is the Peak message value, m is
  2029. the current quantised message value.  (The formulae get simpler if you
  2030. substitute x for m/mp and sgn(x) for sgn(m); then -1 <= x <= 1.)
  2031.  
  2032. Converting from u-LAW to A-LAW is in a sense "lossy" since there are
  2033. quantizing errors introduced in the conversion.
  2034.  
  2035. "..the u-LAW used in North America and Japan, and the
  2036. A-LAW used in Europe and the rest of the world and
  2037. international routes.."
  2038.  
  2039. References:
  2040.  
  2041. Modern Digital and Analog Communication Systems, B.P.Lathi., 2nd ed.
  2042. ISBN 0-03-027933-X
  2043.  
  2044. Transmission Systems for Communications
  2045. Fifth Edition
  2046. by Members of the Technical Staff at Bell Telephone Laboratories
  2047. Bell Telephone Laboratories, Incorporated
  2048. Copyright 1959, 1964, 1970, 1982
  2049.  
  2050. A note on the resolution of U-LAW by Frank Klemm <pfk@rz.uni-jena.de>:
  2051.  
  2052. 8 bit U-LAW has the same lowest  magnitude like 12 bit linear and 12 bit
  2053. U-LAW like 16 linear.
  2054.  
  2055. Device/Coding   Resolution              Resolution
  2056.                 on maximal level        on low level
  2057.  8 bit linear    8                       8
  2058.  8 bit ulaw      6                      12      (used for digital telephone)
  2059. 12 bit linear   12                      12
  2060. 12 bit ulaw     10                      16      (used in DAT/Longplay)
  2061. 16 bit linear   16                      16
  2062.  
  2063. estimated for some analoge technique:
  2064. tape recorder (HiFi DIN)
  2065.                  8                       9      (no Problem today)
  2066. tape recorder (semiprofessional)
  2067.                 10.5                    13.5 
  2068.  
  2069. ------------------------------------------------------------------------
  2070. AVR File Format
  2071. ---------------
  2072.  
  2073. From: hyc@hanauma.Jpl.Nasa.Gov (Howard Chu)
  2074.  
  2075. A lot of PD software exists to play Mac .snd files on the ST. One other
  2076. format that seems pretty popular (used by a number of commercial packages)
  2077. is the AVR format (from Audio Visual Research). This format has a 128 byte
  2078. header that looks like this:
  2079.  
  2080.         char magic[4]="2BIT";
  2081.         char name[8];           /* null-padded sample name */
  2082.         short mono;             /* 0 = mono, 0xffff = stereo */
  2083.         short rez;              /* 8 = 8 bit, 16 = 16 bit */
  2084.         short sign;             /* 0 = unsigned, 0xffff = signed */
  2085.         short loop;             /* 0 = no loop, 0xffff = looping sample */
  2086.         short midi;             /* 0xffff = no MIDI note assigned,
  2087.                                    0xffXX = single key note assignment
  2088.                                    0xLLHH = key split, low/hi note */
  2089.         long rate;              /* sample frequency in hertz */
  2090.         long size;              /* sample length in bytes or words (see rez) */
  2091.         long lbeg;              /* offset to start of loop in bytes or words.
  2092.                                    set to zero if unused. */
  2093.         long lend;              /* offset to end of loop in bytes or words.
  2094.                                    set to sample length if unused. */
  2095.         short res1;             /* Reserved, MIDI keyboard split */
  2096.         short res2;             /* Reserved, sample compression */
  2097.         short res3;             /* Reserved */
  2098.         char ext[20];           /* Additional filename space, used
  2099.                                    if (name[7] != 0) */
  2100.         char user[64];          /* User defined. Typically ASCII message. */
  2101.  
  2102. -----------------------------------------------------------------------
  2103. The Amiga MOD Format
  2104. --------------------
  2105.  
  2106. From: norlin@mailhost.ecn.uoknor.edu (Norman Lin)
  2107.  
  2108. MOD files are music files containing 2 parts:
  2109.  
  2110. (1) a bank of digitized samples
  2111. (2) sequencing information describing how and when to play the samples
  2112.  
  2113. MOD files originated on the Amiga, but because of their flexibility
  2114. and the extremely large number of MOD files available, MOD players
  2115. are now available for a variety of machines (IBM PC, Mac, Sparc
  2116. Station, etc.)
  2117.  
  2118. The samples in a MOD file are raw, 8 bit, signed, headerless, linear
  2119. digital data.  There may be up to 31 distinct samples in a MOD file,
  2120. each with a length of up to 128K (though most are much smaller; say,
  2121. 10K - 60K).  An older MOD format only allowed for up to 15 samples in
  2122. a MOD file; you don't see many of these anymore.  There is no standard
  2123. sampling rate for these samples.  [But see below.]
  2124.  
  2125. The sequencing information in a MOD file contains 4 tracks of
  2126. information describing which, when, for how long, and at what frequency
  2127. samples should be played.  This means that a MOD file can have up
  2128. to 31 distinct (digitized) instrument sounds, with up to 4 playing
  2129. simultaneously at any given point.  This allows a wide variety
  2130. of orchestrational possibilities, including use of voice samples
  2131. or creation of one's own instruments (with appropriate sampling
  2132. hardware/software).  The ability to use one's own samples as instruments
  2133. is a flexibility that other music files/formats do not share, and
  2134. is one of the reasons MOD files are so popular, numerous, and diverse.
  2135.  
  2136. 15 instrument MODs, as noted above, are somewhat older than 31
  2137. instrument MODs and are not (at least not by me) seen very often
  2138. anymore.  Their format is identical to that of 31 instrument MODs
  2139. except:
  2140.  
  2141. (1) Since there are only 15 samples, the information for the last (15th)
  2142.     sample starts at byte 440 and goes through byte 469.
  2143. (2) The songlength is at byte 470 (contrast with byte 950 in 31 instrument
  2144.     MOD)
  2145. (3) Byte 471 appears to be ignored, but has been observed to be 127.
  2146.     (Sorry, this is from observation only)
  2147. (4) Byte 472 begins the pattern sequence table (contrast with byte 952
  2148.     in a 31 instrument MOD)
  2149. (5) Patterns start at byte 600 (contrast with byte 1084 in 31 instrument MOD)
  2150.  
  2151. "ProTracker," an Amiga MOD file creator/editor, is available for ftp
  2152. everywhere as pt??.lzh.
  2153.  
  2154. From: Apollo Wong <apollo@ee.ualberta.ca>
  2155.  
  2156. From: M.J.H.Cox@bradford.ac.uk (Mark Cox)
  2157. Newsgroups: alt.sb.programmer
  2158. Subject: Re: Format for MOD files...
  2159. Message-ID: <1992Mar18.103608.4061@bradford.ac.uk>
  2160. Date: 18 Mar 92 10:36:08 GMT
  2161. Organization: University of Bradford, UK
  2162.  
  2163. wdc50@DUTS.ccc.amdahl.com (Winthrop D Chan) writes:
  2164. >I'd like to know if anyone has a reference document on the format of the
  2165. >Amiga Sound/NoiseTracker (MOD) files. The author of Modplay said he was going
  2166. >to release such a document sometime last year, but he never did. If anyone
  2167.  
  2168. I found this one, which covers it better than I can explain it - if you
  2169. use this in conjunction with the documentation that comes with Norman
  2170. Lin's Modedit program it should pretty much cover it.
  2171.  
  2172. Mark J Cox
  2173.  
  2174. /***********************************************************************
  2175.  
  2176. Protracker 1.1B Song/Module Format:
  2177. -----------------------------------
  2178.  
  2179. Offset  Bytes  Description
  2180. ------  -----  -----------
  2181.    0     20    Songname. Remember to put trailing null bytes at the end...
  2182.  
  2183. Information for sample 1-31:
  2184.  
  2185. Offset  Bytes  Description
  2186. ------  -----  -----------
  2187.   20     22    Samplename for sample 1. Pad with null bytes.
  2188.   42      2    Samplelength for sample 1. Stored as number of words.
  2189.                Multiply by two to get real sample length in bytes.
  2190.   44      1    Lower four bits are the finetune value, stored as a signed
  2191.                four bit number. The upper four bits are not used, and
  2192.                should be set to zero.
  2193.                Value:  Finetune:
  2194.                  0        0
  2195.                  1       +1
  2196.                  2       +2
  2197.                  3       +3
  2198.                  4       +4
  2199.                  5       +5
  2200.                  6       +6
  2201.                  7       +7
  2202.                  8       -8
  2203.                  9       -7
  2204.                  A       -6
  2205.                  B       -5
  2206.                  C       -4
  2207.                  D       -3
  2208.                  E       -2
  2209.                  F       -1
  2210.  
  2211.   45      1    Volume for sample 1. Range is $00-$40, or 0-64 decimal.
  2212.   46      2    Repeat point for sample 1. Stored as number of words offset
  2213.                from start of sample. Multiply by two to get offset in bytes.
  2214.   48      2    Repeat Length for sample 1. Stored as number of words in
  2215.                loop. Multiply by two to get replen in bytes.
  2216.  
  2217. Information for the next 30 samples starts here. It's just like the info for
  2218. sample 1.
  2219.  
  2220. Offset  Bytes  Description
  2221. ------  -----  -----------
  2222.   50     30    Sample 2...
  2223.   80     30    Sample 3...
  2224.    .
  2225.    .
  2226.    .
  2227.  890     30    Sample 30...
  2228.  920     30    Sample 31...
  2229.  
  2230. Offset  Bytes  Description
  2231. ------  -----  -----------
  2232.  950      1    Songlength. Range is 1-128.
  2233.  951      1    Well... this little byte here is set to 127, so that old
  2234.                trackers will search through all patterns when loading.
  2235.                Noisetracker uses this byte for restart, but we don't.
  2236.  952    128    Song positions 0-127. Each hold a number from 0-63 that
  2237.                tells the tracker what pattern to play at that position.
  2238. 1080      4    The four letters "M.K." - This is something Mahoney & Kaktus
  2239.                inserted when they increased the number of samples from
  2240.                15 to 31. If it's not there, the module/song uses 15 samples
  2241.                or the text has been removed to make the module harder to
  2242.                rip. Startrekker puts "FLT4" or "FLT8" there instead.
  2243.  
  2244. Offset  Bytes  Description
  2245. ------  -----  -----------
  2246. 1084    1024   Data for pattern 00.
  2247.    .
  2248.    .
  2249.    .
  2250. xxxx  Number of patterns stored is equal to the highest patternnumber
  2251.       in the song position table (at offset 952-1079).
  2252.  
  2253. Each note is stored as 4 bytes, and all four notes at each position in
  2254. the pattern are stored after each other.
  2255.  
  2256. 00 -  chan1  chan2  chan3  chan4
  2257. 01 -  chan1  chan2  chan3  chan4
  2258. 02 -  chan1  chan2  chan3  chan4
  2259. etc.
  2260.  
  2261. Info for each note:
  2262.  
  2263.  _____byte 1_____   byte2_    _____byte 3_____   byte4_
  2264. /                \ /      \  /                \ /      \
  2265. 0000          0000-00000000  0000          0000-00000000
  2266.  
  2267. Upper four    12 bits for    Lower four    Effect command.
  2268. bits of sam-  note period.   bits of sam-
  2269. ple number.                  ple number.
  2270.  
  2271. Periodtable for Tuning 0, Normal
  2272.   C-1 to B-1 : 856,808,762,720,678,640,604,570,538,508,480,453
  2273.   C-2 to B-2 : 428,404,381,360,339,320,302,285,269,254,240,226
  2274.   C-3 to B-3 : 214,202,190,180,170,160,151,143,135,127,120,113
  2275.  
  2276. To determine what note to show, scan through the table until you find
  2277. the same period as the one stored in byte 1-2. Use the index to look
  2278. up in a notenames table.
  2279.  
  2280. This is the data stored in a normal song. A packed song starts with the
  2281. four letters "PACK", but i don't know how the song is packed: You can
  2282. get the source code for the cruncher/decruncher from us if you need it,
  2283. but I don't understand it; I've just ripped it from another tracker...
  2284.  
  2285. In a module, all the samples are stored right after the patterndata.
  2286. To determine where a sample starts and stops, you use the sampleinfo
  2287. structures in the beginning of the file (from offset 20). Take a look
  2288. at the mt_init routine in the playroutine, and you'll see just how it
  2289. is done.
  2290.  
  2291. Lars "ZAP" Hamre/Amiga Freelancers
  2292.  
  2293. ***********************************************************************/
  2294.  
  2295. -- 
  2296. Mark J Cox -----
  2297. Bradford, UK ---
  2298.  
  2299.  
  2300. PS: A file with even *much* more info on MOD files, compiled by Lars
  2301. Hamre, is available from ftp.cwi.nl:/pub/audio/MOD-info.  Enjoy!
  2302.  
  2303.  
  2304. FTP sites for MODs and MOD players
  2305. ----------------------------------
  2306.  
  2307. Subject: MODS AND PLAYERS!! **READ** info/where to get them
  2308. From: cjohnson@tartarus.uwa.edu.au (Christopher Johnson)
  2309. Newsgroups: alt.binaries.sounds.d
  2310. Message-ID: <1h32ivINNglu@uniwa.uwa.edu.au>
  2311. Date: 21 Dec 92 00:19:43 GMT
  2312. Organization: The University of Western Australia
  2313.  
  2314. Hello world,
  2315.  
  2316. For all those asking, here is where to get those mod players and mods.
  2317.  
  2318. SNAKE.MCS.KENT.EDU is the best site for general stuff.  look in /pub/SB-Adlib
  2319.  
  2320. Simtel-20 or archie.au(simtel mirror) in <msdos.sound>
  2321.  
  2322. for windows players ftp.cica.indiana.edu in pub/pc/win3/sound
  2323.  
  2324. here is a short list of players
  2325.  
  2326. mp or modplay   BEST OVERALL                    mp219b.zip      
  2327.         simtel and snake
  2328.  
  2329. wowii           best for vga/fast machines      wowii12b.zip    
  2330.         simtel and snake
  2331.  
  2332. trakblaster     best for compatability          trak-something  
  2333.         simtel and snake        two versions, old one for slow
  2334.         machines
  2335.  
  2336. ss              cute display(hifi)              have_sex.arj
  2337.         found on local BBS (western Australia White Ghost)
  2338.  
  2339. superpro player generally good                  ssp.zip or similar
  2340.         found on night owl 7 CD
  2341.  
  2342. player?         cute display(hifi)              player.zip or similar
  2343.         found on night owl 7 CD
  2344.  
  2345. WINDOWS
  2346.  
  2347. Winmod pro      does protracker                 wmp????.zip
  2348.         cica
  2349.  
  2350. winmod          more stable                     winmod12.zip or similar
  2351.         cica
  2352.  
  2353. Hope this helps, e-mail me if you find any more players and I will add them in for the next time mod player requests get a
  2354. little out of hand.
  2355.  
  2356. for mods ftp to wuarchive.wustl.edu and go to the amiga music directory (pub/amiga/music/ntsb ?????)  that should do you for
  2357. a while
  2358.  
  2359. see you soon
  2360.  
  2361. Chris.
  2362.  
  2363. -----------------------------------------------------------------------
  2364. The Sample Vision Format
  2365. ------------------------
  2366.  
  2367. From: "tim.dorcas@enest.com" <KURTZ@URIACC.URI.EDU>
  2368.  
  2369. First, Sample Vision is a program used by professional musicians to
  2370. send and receive samples via a MIDI interface to the PC. While on the
  2371. PC, you can edit several parameters including loop points, pitch, time
  2372. compression, normalize, sample rate, ect.  The list of supported
  2373. samplers include: AKAI {S700,X700,S900, S950,S612,S1000/1100},
  2374. Casio{FZ1,FZ10M,FZ20M}, Ensoniq{EPS,EPS16,ASR10,Mirage},
  2375. Emu{Emax,EmaxII}, Korg{DSS1,DSM1,T workstation}, Oberheim DPX-1,
  2376. Peavey DPM-3, Roland {S10,MKS100,S220,S50,S330,S550}, Sequential
  2377. Circuits Prophet 2000/2002, Sample Dump Standard devices, Yamaha
  2378. TX16W.
  2379.  
  2380. The .smp format breaks down like this:
  2381.  
  2382. Offset     Size        Description
  2383. 000        18          'SOUND SAMPLE DATA ' ASCII FILE ID
  2384. 0018       04          '2.1 '   ASCII FILE VERSION
  2385. 0022       60          USER COMMENTS    60 ASCII CHARACTERS
  2386. 0082       30          SAMPLE NAME    LEFT JUSTIFIED 30 ASCII CHARACTERS
  2387. 0112       04          SAMPLE SIZE   SAMPLE DATA COUNT IN WORDS
  2388. 0116       ??          SAMPLE DATA  1 WORD PER SAMPLE, LEAST SIGNIFICANT BYTE
  2389.                                     FIRST, LSW FIRST; SIGNED 16 BIT INTEGERS
  2390.  
  2391. ??         02(DW)      RESERVED
  2392. ??         04(DD)      LOOP 1 START  USE SAMPLE COUNT NOT BYTE COUNT
  2393. ??         04(DD)      LOOP 1 END
  2394. ??         01(DB)      LOOP 1 TYPE   0=LOOP OFF,1=FORWARD,2=FORWARD/BACKWARD
  2395. ??         02(DW)      LOOP 1 COUNT  TIMES TO EXECUTE LOOP BEFORE NEXT LOOP
  2396.  
  2397. THERE ARE SEVEN MORE IDENTICAL LOOP STRUCTURES FOR A TOTAL OF 8
  2398.  
  2399. ??         10          MARKER 1 NAME ASCII MARKER NAME
  2400. ??         04(DD)      MARKER 1 POSITION  FFFF MEANS UNUSED
  2401.  
  2402. THER ARE SEVEN MORE IDENTICAL MARKER STRUCTURES FOR A TOTAL OF 8
  2403.  
  2404. ??         01(DB)       MIDI UNITY PLAYBACK NOTE         MIDI NOTE TO PLAY
  2405.                                                          THE SAMPLE AT ITS
  2406.                                                          ORIGINAL PITCH
  2407. ??         04(DD)       SAMPLE RATE IN HERTZ
  2408. ??         04(DD)       SMPTE OFFSET IN SUBFRAMES
  2409. ??         04(DD)       CYCLE SIZE         SAMPLE COUNT IN ONE CYCLE OF
  2410.                                            THE SAMPLED SOUND. -1 IF UNKNOWN
  2411.  
  2412. (DD) 4 BYTES, LS BYTE FIRST, LS WORD FIRST
  2413. (DW) 2 BYTES, LS BYTE FIRST
  2414. (DB) 1 BYTE
  2415.  
  2416. That's about it. One thing I have noticed is that Sample Vision only
  2417. writes seven loop structures to file as opposed to the eight
  2418. structures it claims are written.
  2419. -----------------------------------------------------------------------
  2420. Some Miscellaneous Formats
  2421. --------------------------
  2422.  
  2423. From: bil@ccrma.Stanford.EDU (Bill Schottstaedt)
  2424.  
  2425. I thought you might find some of this information amusing -- a few
  2426. header formats I didn't find in your great audio file formats
  2427. documentation.  Some taken from the AFsp sources, or sox, or
  2428. local ancient documentation.  I also have short descriptions
  2429. of BICSF, NeXT/Sun, AIFF, RIFF, SMP, VOC, and so on, plus
  2430. full descriptions of the 2 Sound Designer formats, if you're
  2431. interested.
  2432.  
  2433.  
  2434. /* ------------------------------------ NIST ---------------------------------
  2435.  
  2436.  * 
  2437.  
  2438.  *   0: "NIST_1A"
  2439.  *   8: data_location as ASCII representation of integer
  2440.  *      (apparently always "   1024")
  2441.  *  16: start of complicated header -- full details available upon request
  2442.  *
  2443.  *  here's an example:
  2444.  *
  2445.  *  NIST_1A
  2446.  *     1024
  2447.  *  database_id -s5 TIMIT
  2448.  *  database_version -s3 1.0
  2449.  *  utterance_id -s8 aks0_sa1
  2450.  *  channel_count -i 1
  2451.  *  sample_count -i 63488
  2452.  *  sample_rate -i 16000
  2453.  *  sample_min -i -6967
  2454.  *  sample_max -i 7710
  2455.  *  sample_n_bytes -i 2
  2456.  *  sample_byte_format -s2 01
  2457.  *  sample_sig_bits -i 16
  2458.  *  end_head
  2459.  */
  2460. /* ------------------------------------ SNDT ---------------------------------
  2461.  *
  2462.  * this taken from sndrtool.c (sox-10):
  2463.  *   0: "SOUND"
  2464.  *   6: 0x1a
  2465.  *   8-11: 0
  2466.  *  12-15: nsamples
  2467.  *  16-19: 0
  2468.  *  20-23: nsamples
  2469.  *  24-25: srate
  2470.  *  26-27: 0
  2471.  *  28-29: 10
  2472.  *  30-31: 4
  2473.  *  32-> : <filename> "- File created by Sound Exchange"
  2474.  *  .->95: 0
  2475.  */
  2476. /* ------------------------------------ ESPS ---------------------------------
  2477.  
  2478.  *
  2479.  *   16: 0x00006a1a or 0x1a6a0000
  2480.  *  136: if not 0, chans + format = 32-bit float
  2481.  *  144: if not 0, chans + format = 16-bit linear
  2482.  * 
  2483.  
  2484.  *   from AFgetInfoES.c:
  2485.  * 
  2486.  
  2487.  *       Bytes     Type    Contents
  2488.  *      8 -> 11    --     Header size (bytes)
  2489.  *     12 -> 15    int    Sampled data record size
  2490.  *     16 -> 19    int    File identifier
  2491.  *     40 -> 65    char   File creation date
  2492.  *    124 -> 127   int    Number of samples (may indicate zero)
  2493.  *    132 -> 135   int    Number of doubles in a data record
  2494.  *    136 -> 139   int    Number of floats in a data record
  2495.  *    140 -> 143   int    Number of longs in a data record
  2496.  *    144 -> 147   int    Number of shorts in a data record
  2497.  *    148 -> 151   int    Number of chars in a data record
  2498.  *    160 -> 167   char   User name
  2499.  *    333 -> H-1   --     Generic header items, including "record_freq"
  2500.  *                        {followed by a "double8"}
  2501.  *      H -> ...   --     Audio data
  2502.  */
  2503. /* ------------------------------------ INRS ---------------------------------
  2504.  
  2505.  * 
  2506.  
  2507.  *   from AFgetInfoIN.c:
  2508.  * 
  2509.  
  2510.  *    INRS-Telecommunications audio file:
  2511.  *       Bytes     Type    Contents
  2512.  *      0 ->  3    float  Sampling Frequency (VAX float format)
  2513.  *      6 -> 25    char   Creation time (e.g. Jun 12 16:52:50 1990)
  2514.  *     26 -> 29    int    Number of speech samples in the file
  2515.  *   The data in an INRS-Telecommunications audio file is in 16-bit integer
  2516.  *   format.
  2517.  * 
  2518.  
  2519.  */
  2520. /* old Mus10, SAM formats, just for completeness
  2521.  *
  2522.  * These were used for sound data on the PDP-10s at SAIL and CCRMA in the
  2523.  * 70's and 80's.
  2524.  * The word length was 36-bits.
  2525.  *
  2526.  * "New" format as used by nearly all CCRMA software pre-1990:
  2527.  *
  2528.  *  WD 0 - '525252525252
  2529.  *  WD 1 - Clock rate in Hz (PDP-10 36-bit floating point)
  2530.  *  WD 2 - #samples per word,,pack-code
  2531.  *      (has # samples per word in LH, pack-code in RH)
  2532.  *      0 for 12-bit fixed point
  2533.  *      1 for 18-bit fixed point
  2534.  *      2 for  9-bit floating point incremental
  2535.  *      3 for 36-bit floating point
  2536.  *      4 for 16-bit sambox fixed point, right justified
  2537.  *      5 for 20-bit sambox fixed point
  2538.  *      6 for 20-bit right-adjusted fixed point (sambox SAT format)
  2539.  *      7 for 16-bit fixed point, left justified
  2540.  *      N>9 for N bit bytes in ILDB format
  2541.  *  WD 3 - # channels
  2542.  *      1 for MONO
  2543.  *      2 for STEREO
  2544.  *      4 for QUAD
  2545.  *  WD 4 - Maximum amplitude (if known)
  2546.  *      is a floating point number
  2547.  *      is zero if not known
  2548.  *      is maximum magnitude (abs value) of signal
  2549.  *  WD 5        number of Sambox ticks per pass
  2550.  *              (inverse of Sambox clock rate, sort of)
  2551.  *  WD 6 - Total #samples in file.
  2552.  *         If 0 then #wds_in_file*#samps_per_wd assumed.
  2553.  *  WD 7 - Block size (if any). 0 means sound is not blocked.
  2554.  *  WDs '10-'77 Reserved for EDSND usage
  2555.  *  WDs '100-'177 Text description of file (in ASCIZ format)
  2556.  *
  2557.  *
  2558.  * "Old" format
  2559.  *
  2560.  *  WD 0 - '525252525252
  2561.  *  WD 1 - Clock rate
  2562.  *      has code in LH, actual INTEGER rate in RH
  2563.  *      code=0 for 6.4Kc (or anything else)
  2564.  *          =1 for 12.8Kc, =2 for 25.6Kc, =3 for 51.2Kc
  2565.  *          =5 for 102.4Kc, =6 for 204.8Kc
  2566.  *  WD 2 - pack
  2567.  *      0 for 12 bit
  2568.  *      1 for 16 bit (18 bit)
  2569.  *      2 for 9 bit floating point incremental
  2570.  *      3 for 36-bit floating point
  2571.  *      N>9 for N bit bytes in ILDB format
  2572.  *      has # samples per word in LH.
  2573.  *  WD 3 - # channels
  2574.  *      1 for MONO
  2575.  *      2 for STEREO
  2576.  *      4 for QUAD
  2577.  *  WD 4 - Maximum amplitude (if known)
  2578.  *      is a floating point number
  2579.  *      is zero if not known
  2580.  *      is maximum magnitude (abs value) of signal
  2581.  *  WDs 5-77 Reserved for future expansion
  2582.  *  WDs 100-177 Text description of file (in ASCIZ format)
  2583.  */
  2584.  
  2585. -----------------------------------------------------------------------
  2586. Tandy Deskmate .snd Format Notes
  2587. --------------------------------
  2588.  
  2589. From: Jeffrey L. Hayes <tvdog@delphi.com>
  2590.  
  2591. Tandy .snd files are created by Sound.pdm, a program that came with the 
  2592. proprietary DeskMate environment.  They are used by Music.pdm to create 
  2593. music modules (.sng files).  DeskMate Sound and Music require the Tandy 
  2594. sound chip.  There is a program to convert RIFF WAVE and other 8-bit PCM 
  2595. formats to .snd, Conv2snd, by Kenneth Udut.  Conv2snd v.2.00 comes with 
  2596. Snd2wav, which converts .snd to RIFF WAVE.
  2597.  
  2598. There are two types of DeskMate .snd files, sound files and instrument 
  2599. files.  Both contain 8-bit unsigned PCM samples.
  2600.  
  2601. Sound files are simpler.  These are garden-variety sample files with a 
  2602. fixed-length header giving the name of the sound, the recording frequency, 
  2603. and the length of the sound.  Sound files may be recorded at 5500Hz, 11kHz 
  2604. or 22kHz.
  2605.  
  2606. Instrument files contain samples as well as frequency and looping 
  2607. information used by Music.pdm to represent an instrument.  Instrument files 
  2608. provide for attack, sustain, and decay with several samples having 
  2609. different implied frequencies and being used by Music.pdm to represent the 
  2610. instrument in different pitch ranges.  Up to 16 different notes (with 16 
  2611. different samples) can be contained in one instrument file.  Instrument 
  2612. files are always recorded at 11kHz.  Both sound files and instrument files 
  2613. may be compressed in one of two ways, "music" compression or "speech" 
  2614. compression, or they may be uncompressed.  I don't know the compression 
  2615. algorithms, but simple file comparison reveals that "music" and "speech" 
  2616. compression are almost identical.
  2617.  
  2618. The DeskMate .snd file header consists of 16 bytes of fixed header 
  2619. information followed by one or more 28-byte note records.  The sample 
  2620. information, which may be compressed, follows the header.
  2621.  
  2622. DeskMate .snd File Format - Fixed Header
  2623. ----------------------------------------
  2624.  
  2625.   offset    size      what
  2626.   ------    ----      ----
  2627.  
  2628.   0         byte      1Ah (.snd ID byte)
  2629.  
  2630.   1         byte      Compression code:  0 = no compression; 1 = music
  2631.                       compression; 2 = sound compression.
  2632.  
  2633.   2         byte      Number of notes in the instrument file.  1 if sound
  2634.                       file.
  2635.  
  2636.   3         byte      Instrument number.  0 if sound file; 0FFh if instrument
  2637.                       file with no number set.  Valid instrument numbers in
  2638.                       an instrument file are 1 to 32.  Use this field to
  2639.                       distinguish a sound file from an instrument file.
  2640.  
  2641.   4         10 bytes  Sound or instrument name.  Filled on the right with
  2642.                       nulls if less than 10 characters.
  2643.  
  2644.   0Eh       word      Sampling rate in samples per second.  Note that although
  2645.                       a sampling rate other than 5500, 11000 and 22000 can be
  2646.                       entered here, Sound.pdm will not actually play at other
  2647.                       rates.
  2648.  
  2649.   10h       variable  Note records begin, 28 bytes each.  Number of records
  2650.                       given in byte 2 above.
  2651.  
  2652.  
  2653. DeskMate .snd File Format - Note Record
  2654. ---------------------------------------
  2655.  
  2656.   0         byte      Pitch of the note:  1 = A1 in American Standard Pitch;
  2657.                       2 = A#1; etc.  A1 is lowest note allowed; highest note
  2658.                       allowed is B6 (3Fh).  Sound files have 0FFh here; so do
  2659.                       instrument files with no note set.
  2660.                           Note that Sound.pdm does not designate notes in the
  2661.                       standard manner to the user.  Although A1 and B6 in
  2662.                       Sound.pdm are the same as A1 and B6 in standard pitch,
  2663.                       Sound.pdm starts octaves at A rather than at C (as is
  2664.                       standard).  Thus, middle C, C4 in standard pitch, is C3
  2665.                       in Sound.pdm.
  2666.  
  2667.   1         byte      Sound files, and instrument files with no pitch set,
  2668.                       have 0 here.  If the pitch is set, this byte is 0FFh.
  2669.  
  2670.   2         2 bytes   Range of the note, first byte is lower limit, second
  2671.                       is higher limit.  Byte encoding as for offset 0 (i.e.,
  2672.                       01h to 3Fh).  Sound files have FF FF here; so do
  2673.                       instrument files with no range set.
  2674.  
  2675.   4         dword     Offset in the file where samples for this note begin
  2676.                       (zero-relative), after compression if that was done.
  2677.  
  2678.   8         dword     If compressed, the length of the compressed data in the
  2679.                       file for this note.  Uncompressed files have 0 here.
  2680.  
  2681.   0Ch       4 bytes   Unknown.  Set to zero.
  2682.  
  2683.   10h       dword     Number of samples in the note, after decompression if
  2684.                       necessary.
  2685.  
  2686.   14h       dword     Number of sample at start of sustain region for the
  2687.                       note, relative to the first (zeroth) sample of the note.
  2688.                       For sound files, or if sustain is not set, this field is
  2689.                       0.
  2690.  
  2691.   18h       dword     Number of sample at end of sustain region for the note,
  2692.                       relative to the first (zeroth) sample of the note.  For
  2693.                       sound files, or if sustain is not set, this field is 0.
  2694.  
  2695.  
  2696. New Tandy .Snd File Format
  2697. --------------------------
  2698.  
  2699. This is the new .snd file format used on the 2500-series.  From information 
  2700. provided by John Ball (john.ball@two-t.com).
  2701.  
  2702. Like the old format, the new format header consists of a fixed part 
  2703. followed by one or more sample descriptors.  The fixed part is 114 bytes;
  2704. the sample descriptors are 46 bytes each.  Samples are still 8-bit unsigned
  2705. PCM.
  2706.  
  2707. Fixed header:
  2708.     offset       size        what
  2709.       0          10 bytes    ASCIIZ name of sound.
  2710.       0Ah        34 bytes    unknown
  2711.       2Ch        2 bytes     New .snd ID:  1Ah 80h.
  2712.       2Eh        word        Number of samples in file.
  2713.       30h        word        Sound (instrument) number.
  2714.       32h        16 bytes    unknown
  2715.       42h        word        Compression code (0 = no compression, 1 =
  2716.                              music compression, 2 = speech compression).
  2717.       44h        20 bytes    unknown
  2718.       58h        word        Sampling rate in Hz.
  2719.       5Ah        24 bytes    unknown
  2720.       72h        variable    Sample descriptors begin.
  2721.  
  2722. Sample descriptors (number given by word at 2Eh above):
  2723.     offset       size        what
  2724.       0          dword       Link to next sample descriptor (offset in file
  2725.                              of next sample descriptor record).  0 if last.
  2726.       4          2 bytes     unknown
  2727.       6          byte        Pitch of note (01h-3Fh), 01 = A1 in American
  2728.                              Standard Pitch; 0FFh if not set.
  2729.       7          byte        unknown (compare old .Snd format; value is 00
  2730.                              or FF, but seemingly unrelated to pitch setting)
  2731.       8          2 bytes     Range of note.  First byte is lower limit,
  2732.                              second is higher limit.  Values as for byte
  2733.                              at offset 6 above; FF FFh if not set.
  2734.       0Ah        dword       Offset in file of start of sound data for
  2735.                              this sample.
  2736.       0Eh        dword       Length of sample sound data in bytes.
  2737.       12h        dword       Uncompressed length of sound data (number of
  2738.                              samples).
  2739.       16h        24 bytes    unknown
  2740. ------------------------------------------------------------------------
  2741.